Feature Effects

class datarobot.models.FeatureEffects(project_id, model_id, source, feature_effects, data_slice_id=None, backtest_index=None)

Feature Effects provides partial dependence and predicted vs actual values for top-500 features ordered by feature impact score.

The partial dependence shows marginal effect of a feature on the target variable after accounting for the average effects of all other predictive features. It indicates how, holding all other variables except the feature of interest as they were, the value of this feature affects your prediction.

Notes

featureEffects is a dict containing the following:

  • feature_name (string) Name of the feature

  • feature_type (string) dr.enums.FEATURE_TYPE, Feature type either numeric, categorical or datetime

  • feature_impact_score (float) Feature impact score

  • weight_label (string) optional, Weight label if configured for the project else null

  • partial_dependence (List) Partial dependence results

  • predicted_vs_actual (List) optional, Predicted versus actual results, may be omitted if there are insufficient qualified samples

partial_dependence is a dict containing the following:
  • is_capped (bool) Indicates whether the data for computation is capped

  • data (List) partial dependence results in the following format

data is a list of dict containing the following:
  • label (string) Contains label for categorical and numeric features as string

  • dependence (float) Value of partial dependence

predicted_vs_actual is a dict containing the following:
  • is_capped (bool) Indicates whether the data for computation is capped

  • data (List) pred vs actual results in the following format

data is a list of dict containing the following:
  • label (string) Contains label for categorical features for numeric features contains range or numeric value.

  • bin (List) optional, For numeric features contains labels for left and right bin limits

  • predicted (float) Predicted value

  • actual (float) Actual value. Actual value is null for unsupervised timeseries models

  • row_count (int or float) Number of rows for the label and bin. Type is float if weight or exposure is set for the project.

Attributes:
project_id: string

The project that contains requested model

model_id: string

The model to retrieve Feature Effects for

source: string

The source to retrieve Feature Effects for

data_slice_id: string or None

The slice to retrieve Feature Effects for; if None, retrieve unsliced data

feature_effects: list

Feature Effects for every feature

backtest_index: string, required only for DatetimeModels,

The backtest index to retrieve Feature Effects for.

classmethod from_server_data(data, *args, use_insights_format=False, **kwargs)

Instantiate an object of this class using the data directly from the server, meaning that the keys may have the wrong camel casing.

Parameters:
datadict

The directly translated dict of JSON from the server. No casing fixes have taken place

use_insights_formatbool, optional

Whether to repack the data from the format used in the GET /insights/featureEffects/ URL to the format used in the legacy URL.

class datarobot.models.FeatureEffectMetadata(status, sources)

Feature Effect Metadata for model, contains status and available model sources.

Notes

source is expected parameter to retrieve Feature Effect. One of provided sources shall be used.

class datarobot.models.FeatureEffectMetadataDatetime(data)

Feature Effect Metadata for datetime model, contains list of feature effect metadata per backtest.

Notes

feature effect metadata per backtest contains:
  • status : string.

  • backtest_index : string.

  • sources : list(string).

source is expected parameter to retrieve Feature Effect. One of provided sources shall be used.

backtest_index is expected parameter to submit compute request and retrieve Feature Effect. One of provided backtest indexes shall be used.

Attributes:
datalist[FeatureEffectMetadataDatetimePerBacktest]

List feature effect metadata per backtest

class datarobot.models.FeatureEffectMetadataDatetimePerBacktest(ff_metadata_datetime_per_backtest)

Convert dictionary into feature effect metadata per backtest which contains backtest_index, status and sources.