unary_operation

Performs a unary math operation.

Usage

Executing a mathematical operation that involves only one operand or input value, such as negation or finding the absolute value of a number

This calculator can be used with the following method:

unary_operation

Examples:

  • Applying "round" function, to forecasted quantities would be rounding the forecasted sales figures to the nearest whole number. For instance, if the forecast predicts 4.6 units, rounding it would result in 5 units.


Main Parameters

  • input_columns list of columns used as input of the calculators: The list of columns that will be used to fill the output column.

  • output_columns list of columns added by the calculators : Name of the filled column added to the dataset.

  • global (true, false) Should this calculator be performed before data splitting during training for cross-validation

  • steps [optionnal] (training, prediction, postprocessing) List of steps in a pipeline where columns from this calculator are added to the data. Note that when the training option is listed, the calculator is actually added during preprocessing.

  • store_in_model [optionnal] (true, false) Please indicate whether the "calculated" columns by the calculator should be stored in the model or not to avoid recalculating them during prediction. This is only relevant if the calculated columns are added to both training and prediction. Without this parameter, the values will not be stored in the model. The following parameters only make sense if this parameter is set to true.

  • stored_columns [required if store_in_model is true] List indicating the columns to be stored among the output_columns.

  • stored_keys [required if store_in_model is true] List indicating the columns to use for identifying the correct values to join on the data for prediction among the stored values (logically, they are to be chosen from the input_columns).


Specific Parameters

  • operation (acos, acosh’, asin, asinh, atan, exp, fabs, factorial, floor, pow, radians, round, sin, sinh, sqrt, tan)


Examples

  1. Suppose we want my predicted package quantity to contain decimals, but what we are interested in is keeping only the integer part. We can use the floor operation for that.

    calculated_cols:
      floor_qty:
        method: unary_operation
        input_columns:
        - qty
        output_columns:
        - floored_qty
        params:
          operation: floor

    Output

    receipt_date
    pos_id
    qty
    floored_qty

    2021-07-03

    3701092636753

    35.56

    35

Last updated