Verteego Doc
  • Getting started
    • About Verteego
    • Sample Use Cases
    • Concepts
  • Data
    • Introduction
    • Datasources
      • URL connector specification
    • Datasets
  • Pipelines
    • Forecasting Pipelines
      • Getting started
      • Configuration
        • Identifying and preparing data
          • calculated_cols
          • cols_type
          • date_col
          • normalize
          • preprocessing
          • prediction_resolution
        • Configuring the Forecasting Algorithm
          • algo_name
          • algo_type
          • algorithm_parameters
          • fit_parameters
          • conditional_algorithm_parameters
        • Building the Training and Prediction Set
          • column_to_predict
          • features
          • input_prediction_columns
        • Using Hyperparameter Tuning for the Model
          • tuning_search_params
          • hyperparameter_tuning_parameters
        • Evaluating the Results of the Forecast
          • scores
        • Modifying the results of the forecast
          • postprocessing
      • Calculators
        • External source
          • get_from_dataset
          • weather
        • Mathematic
          • aggregate_val_group_by_key
          • binary_operation
          • count_rows_by_keys
          • hierarchical_aggregate
          • mathematical_expression
          • unary_operation
          • Moving Average (EWM)
        • Machine Learning
          • pca
          • clustering
          • glmm_encoder
          • one_hot_encode
          • words_similarity
        • Transformation
          • fillna
          • fill_series
          • case_na
          • interval_index
          • constant
          • cyclic
          • replace
        • Temporal
          • bank_holidays_countdown
          • bankholidays
          • date_attributes
          • date_weight
          • day_count
          • duration
          • events_countdown
          • seasonality
          • tsfresh
    • Optimization Pipelines
      • Getting started
      • Configuration
      • Constraints
        • Unary Constraint
        • Binary Constraint
        • Aggregation Constraint
        • Order Constraint
        • Multiplicative Equality Constraint
        • Generate constraints from a Dataset
  • Apps
    • About Apps
    • Recipes
      • Pipelines
      • Datasets
  • Users
    • User roles
  • Best practices
    • Performance analysis and ML model improvement
  • Developers
    • API
    • Change logs
Powered by GitBook
On this page
  • Overview
  • Application
  • Parameters
  • Examples
  • Best Practices
  1. Pipelines
  2. Optimization Pipelines
  3. Constraints

Binary Constraint

Overview

Binary Constraints in Verteego enable direct comparison or interaction between two columns within a dataset, which can be either variable or static. This type of constraint is applied on a row-by-row basis, making it suitable for conditions where variables within the same dataset must maintain a specific relationship to one another.

Application

Binary Constraints are commonly used to enforce relationships such as ensuring one value remains greater than or less than another (e.g., a product’s price must always be higher than a competitor’s price).

Parameters

  • where: An optional dictionary of key-value pairs that filters rows based on specified conditions. For instance, setting where={"month": [1, 2, 3], "year": 2022} would apply the constraint only to rows from the first quarter of 2022, ignoring all others.

  • left_column: Specifies the column containing the variable or static number to be constrained.

  • left_column_weight: Optional. A column containing weights to be applied to values in the left_column.

  • operator: Defines the relationship between the left and right column values. Options are equal, lesser (less than or equal to), and greater (greater than or equal to).

  • right_column: Specifies the column against which the left_column is being constrained.

  • right_column_weight: Similar to left_column_weight, for applying weights to the right_column.

  • delta: An optional numerical value that offsets the constraint, adding flexibility to the condition (e.g., price must be greater than competition_price + 1).

  • relax: Indicates whether the constraint can be relaxed (with a penalty that gets reported). Defaults to false.

Examples

Below are examples of YAML configurations for binary constraints:

  • Setting a Minimum Price Above Competition:

yamlCopy codecompetition_lower_bound:
  constraint_type: binary
  left_column: price
  operator: greater
  right_column: competition_price
  delta: 0
  relax: false
  • Setting a Maximum Price Below an Upper Limit:

yamlCopy codecompetition_upper_bound:
  constraint_type: binary
  left_column: price
  operator: lesser
  right_column: competition_upper_bound_price
  delta: 0
  relax: false

Best Practices

When implementing Binary Constraints, it is crucial to:

  • Select relevant columns for the left and right sides of the equation to ensure meaningful comparisons.

  • Use appropriate weights and deltas to refine the conditions under which constraints apply.

  • Consider using the relax parameter for scenarios where strict adherence to constraints might not always be possible or desirable, allowing for more flexible optimization solutions.

PreviousUnary ConstraintNextAggregation Constraint

Last updated 1 year ago