Monotonicity Detector
MonotonicityDetector.Rd
Detects whether a feature should have a monotone increasing or decreasing effect (if enforced) and quantifies the tendency of a monotone relationship between the feature and the target.
This detector utilizes decision trees to fit the feature and target variable using subsampled data and calculates Spearman's Rho between the predicted values (numeric for regression and probability of the positive class for binary classification) and the feature. The Spearman's Rho values serve as indicators of the presence of a monotone relationship between features and the target and can also help infer the sign of the feature if it should be constrained to have a monotone effect.
Note that this detector only works with integer or numeric features. Logical features must be converted to integers.
Public fields
task
(mlr3::Task)
The task.n_features
(integer(1))
The number of features in the mlr3::Task.feature_names
(character())
The names of the features in the mlr3::Task.feature_types
(character())
The types of the features in the mlr3::Task.rho_table
(data.table::data.table)
A data.table with as many rows as features. It has a "feature_name" column indicating the feature and a "rho" column indicating Spearman's Rho.unconstrained_weight_table
(data.table::data.table)
A data.table with as many rows as features. It has a "feature_name" column indicating the feature and an "unconstrained_weight" column indicating 1 minus the absolute Spearman's Rho rescaled to the range[0.2, 0.8]
.
Methods
Method compute_rho_table()
Fits a decision tree for each feature and the target variable using subsampled data and calculates Spearman's Rho
between the predicted values (numeric for regression and probability of the positive class for binary classification)
and the feature. This process is repeated for each feature ten times, and the average Spearman's Rho values are stored
in the $rho_table
. The subsampling fraction is set to 0.9
, and the decision tree used is a standard
mlr3::LearnerRegr or mlr3::LearnerClassif.
Method get_sign()
Determines the sign of a given feature based on the average Spearman's Rho correlation, if the feature should be constrained to have a monotone effect.
Method compute_unconstrained_weight_table()
Constructs the unconstrained weights table from the average Spearman's Rhos by taking 1 minus the absolute value and scaling it to the range [0.2, 0.8]
.