Monotonicity Constraints

Monotonicity can be enforced for the feature engineering pipeline, the fitted model(s), or the entire modeling pipeline.

Monotonicity constraints enforce a monotonic relationship between a specified feature and the target prediction. For example, given a model trained to predict housing prices, you may want to enforce that the model predicts higher housing prices with increasing lot size and lower housing prices with increasing neighborhood crime rate.

When monotonicity constraints are enabled, Driverless AI automatically determines if monotonicity is present and then enforces it through all or part of the modeling pipelines. Depending on the level of correlation between a feature and the target, Driverless AI assigns positive, negative, or no monotonicity constraints. Specifically, monotonicity is enforced if the absolute correlation is greater than a specific threshold (default 0.1).

To build an entire monotonic gbm modeling pipeline with a single click, user can select the monotonic_gbm recipe from the Experiment settings of the expert panel. Driverless AI will automatically adjust multiple settings so that monotonicity is enforced on the feature engineering and model building level. For details see Monotonic GBM in pipeline building recipe under experiment expert settings.

For more granular control, over thresholds, manual override of monotonicity constraints etc, refer to these settings under feature settings of the expert panel of an experiment.

To build monotonic fitted models, ensure that:

  • The Interpretability setting for the experiment must be greater than or equal to the monotonicity_constraints_interpretability_switch, that has a default value of 7). So Interpretability setting for the experiment and/or monotonicity_constraints_interpretability_switch can be toggled to achieve this.

  • The final model must be linear (for example, GLMModel) or otherwise support monotonic constraints (LightGBMModel, XGBoostGBMModel, XGBoostDartModel or Decision Tree models). These can be set to ‘ON’ from the Model settings of the expert panel. The ensemble level can be toggled by setting fixed_ensemble_level level. For no ensemble model, set it to 0.

  • Drop features with low correlation to the target. See monotonicity constraints drop low correlation features.

  • For regression case, make sure the target_transformer is monotonic like ‘identity’ or ‘identity_noclip’. This can be toggled under experiment settings of the expert panel.

and for monotonic feature engineering:

  • Disable features engineered from multi-feature interaction i.e set max_feature_interaction_depth to 1 in feature settings under expert settings panel.

  • Disable numerical to categorical feature transformations i.e set num_as_cat to False in the feature settings under expert settings panel.

  • For numeric features, allow only monotonic transformations i.e set included_transformers to [‘OriginalTransformer’] only under recipe settings of the expert panel.

The following table lists an example of settings to create a monotonic Driverless AI modeling pipeline. To enable entire monotonic gbm modeling pipeline with a single click see monotonic_gbm recipe in pipeline building recipe under experiment expert settings.

Recommended Settings

Configuration Name





Triggers monotonicity constraints with a value equal to or less than the Interpretability knob value



Sets the Pearson product-moment correlation coefficient threshold between a feature and target



Drops features below the monotonicity_constraints_correlation_threshold amount



Prevents engineering features from feature interactions



Prevents converting numeric features to categorical



Turns off ‘feature brain’ to ensure every restart is identical


[‘LightGBMModel’, ‘XGBoostGBMModel’]

Models that can respect monotonicity constraints


[‘OriginalTransformer’, ‘CatOriginalTransformer’, ‘RawTransformer’,

‘CVTargetEncodeTransformer’, ‘FrequentTransformer’, ‘WeightOfEvidenceTransformer’,

‘OneHotEncodingTransformer’], [‘CatTransformer’, ‘StringConcatTransformer’],

[‘DateOriginalTransformer’, ‘DateTimeOriginalTransformer’, ‘DatesTransformer’,

‘DateTimeDiffTransformer’, ‘IsHolidayTransformer’, ‘LagsTransformer’,

‘EwmaLagsTransformer’, ‘LagsInteractionTransformer’, ‘LagsAggregatesTransformer’],

[‘TextOriginalTransformer’, ‘TextTransformer’, ‘StrFeatureTransformer’,

‘TextCNNTransformer’, ‘TextBiGRUTransformer’, ‘TextCharCNNTransformer’],

[‘BERTTransformer’, ‘ImageOriginalTransformer’, ‘ImageVectorizerTransformer’]

Monotonic Transformations (list order: numeric, categorical, date/time, text, and image)