limits#

Limits for the solver variables

class wip.modules.limits.Limits[source]#

Bases: object

Methods

define_limit_by_normalization(scalers, ...)

Define upper and lower bounds by variable normalization.

define_limit_by_quantile(feature, ...)

Define upper and lower bounds by percentiles.

define_limit_by_rolling_mean(feature, ...)

Set lower- and upper-bound for a variable defined inside wip.files.rolling_limits.

parse_limits(limits)

Parse json limits:

read_limits(limits[, feature])

Read and return the limit's values

define_bentonita_limit

define_constant_limits

define_flotcor_limit

define_work_dataset

limits_by_rolling_mean

static define_bentonita_limit(feature, datasets, production_query, scalers)[source]#
static define_constant_limits(feature, limits)[source]#
static define_flotcor_limit(feature, scalers)[source]#
static define_limit_by_normalization(scalers, feature, limits)[source]#

Define upper and lower bounds by variable normalization.

Returns both values when lmin and lmax are defined Return a left value when only lmin is defined Return a right value when only lmax is defined

static define_limit_by_quantile(feature, models_features, production_query, limits)[source]#

Define upper and lower bounds by percentiles.

Parameters
  • feature (str) – Feature name and the array with the feature values

  • models_features (dict) – Dictionary with each of the model’s features

  • production_query (pd.Series) – A pandas.Series that contains the query to filter values with.

  • limits (dict) – Dictionary with the limits for each feature.

static define_limit_by_rolling_mean(feature, production_query, datasets, rolling_limits)[source]#

Set lower- and upper-bound for a variable defined inside wip.files.rolling_limits.

Parameters
  • feature (str) – The tag name defined as dictionary key inside wip.files.rolling_limits.

  • production_query

  • datasets (Dict[str, pd.DataFrame]) – Dictionary of pandas.DataFrame with the input datasets.

  • rolling_limits (Dict[str, Dict[str, int | float]]) – Dictionary containing the rolling limits to be used for defining the optimization variable’s lower- and upper-bounds.

Returns

Lower- and upper-bounds calculated from the rolling limit.

Return type

Tuple[float, float]

static define_work_dataset(feature, datasets, production_query)[source]#
static limits_by_rolling_mean(df, rolling, quant_one, quant_two)[source]#
static parse_limits(limits)[source]#
Parse json limits:

# tag limits have tags with the same limits as others

static read_limits(limits, feature=None)[source]#

Read and return the limit’s values