Feature
- class datarobot.models.Feature
A feature from a project’s dataset
These are features either included in the originally uploaded dataset or added to it via feature transformations. In time series projects, these will be distinct from the
ModelingFeature
s created during partitioning; otherwise, they will correspond to the same features. For more information about input and modeling features, see the time series documentation.The
min
,max
,mean
,median
, andstd_dev
attributes provide information about the distribution of the feature in the EDA sample data. For non-numeric features or features created prior to these summary statistics becoming available, they will be None. For features where the summary statistics are available, they will be in a format compatible with the data type, i.e. date type features will have their summary statistics expressed as ISO-8601 formatted date strings.- Variables:
id (
int
) – the id for the feature - note that name is used to reference the feature instead of idproject_id (
str
) – the id of the project the feature belongs toname (
str
) – the name of the featurefeature_type (
str
) – the type of the feature, e.g. ‘Categorical’, ‘Text’importance (
float
orNone
) – numeric measure of the strength of relationship between the feature and target (independent of any model or other features); may be None for non-modeling features such as partition columnslow_information (
bool
) – whether a feature is considered too uninformative for modeling (e.g. because it has too few values)unique_count (
int
) – number of unique valuesna_count (
int
orNone
) – number of missing valuesdate_format (
str
orNone
) – For Date features, the date format string for how this feature was interpreted, compatible with https://docs.python.org/2/library/time.html#time.strftime . For other feature types, None.min (
str
,int
,float
, orNone
) – The minimum value of the source data in the EDA samplemax (
str
,int
,float
, orNone
) – The maximum value of the source data in the EDA samplemean (
str
,int
,or
,float
) – The arithmetic mean of the source data in the EDA samplemedian (
str
,int
,float
, orNone
) – The median of the source data in the EDA samplestd_dev (
str
,int
,float
, orNone
) – The standard deviation of the source data in the EDA sampletime_series_eligible (
bool
) – Whether this feature can be used as the datetime partition column in a time series project.time_series_eligibility_reason (
str
) – Why the feature is ineligible for the datetime partition column in a time series project, or ‘suitable’ when it is eligible.time_step (
int
orNone
) – For time series eligible features, a positive integer determining the interval at which windows can be specified. If used as the datetime partition column on a time series project, the feature derivation and forecast windows must start and end at an integer multiple of this value. None for features that are not time series eligible.time_unit (
str
orNone
) – For time series eligible features, the time unit covered by a single time step, e.g. ‘HOUR’, or None for features that are not time series eligible.target_leakage (
str
) – Whether a feature is considered to have target leakage or not. A value of ‘SKIPPED_DETECTION’ indicates that target leakage detection was not run on the feature. ‘FALSE’ indicates no leakage, ‘MODERATE’ indicates a moderate risk of target leakage, and ‘HIGH_RISK’ indicates a high risk of target leakagefeature_lineage_id (
str
) – id of a lineage for automatically discovered features or derived time series features.key_summary (
list
ofdict
) –Statistics for top 50 keys (truncated to 103 characters) of Summarized Categorical column example:
{‘key’:’DataRobot’, ‘summary’:{‘min’:0, ‘max’:29815.0, ‘stdDev’:6498.029, ‘mean’:1490.75, ‘median’:0.0, ‘pctRows’:5.0}}
- where,
- key: string or None
name of the key
- summary: dict
statistics of the key
max: maximum value of the key. min: minimum value of the key. mean: mean value of the key. median: median value of the key. stdDev: standard deviation of the key. pctRows: percentage occurrence of key in the EDA sample of the feature.
multilabel_insights_key (
str
orNone
) – For multicategorical columns this will contain a key for multilabel insights. The key is unique for a project, feature and EDA stage combination. This will be the key for the most recent, finished EDA stage.
- classmethod get(project_id, feature_name)
Retrieve a single feature
- Parameters:
project_id (
str
) – The ID of the project the feature is associated with.feature_name (
str
) – The name of the feature to retrieve
- Returns:
feature – The queried instance
- Return type:
- get_multiseries_properties(multiseries_id_columns, max_wait=600)
Retrieve time series properties for a potential multiseries datetime partition column
Multiseries time series projects use multiseries id columns to model multiple distinct series within a single project. This function returns the time series properties (time step and time unit) of this column if it were used as a datetime partition column with the specified multiseries id columns, running multiseries detection automatically if it had not previously been successfully ran.
- Parameters:
multiseries_id_columns (
List[str]
) – the name(s) of the multiseries id columns to use with this datetime partition column. Currently only one multiseries id column is supported.max_wait (
Optional[int]
) – if a multiseries detection task is run, the maximum amount of time to wait for it to complete before giving up
- Returns:
properties –
A dict with three keys:
time_series_eligible : bool, whether the column can be used as a partition column
time_unit : str or null, the inferred time unit if used as a partition column
time_step : int or null, the inferred time step if used as a partition column
- Return type:
dict
- get_cross_series_properties(datetime_partition_column, cross_series_group_by_columns, max_wait=600)
Retrieve cross-series properties for multiseries ID column.
This function returns the cross-series properties (eligibility as group-by column) of this column if it were used with specified datetime partition column and with current multiseries id column, running cross-series group-by validation automatically if it had not previously been successfully ran.
- Parameters:
datetime_partition_column (
datetime partition column
)cross_series_group_by_columns (
List[str]
) – the name(s) of the columns to use with this multiseries ID column. Currently only one cross-series group-by column is supported.max_wait (
Optional[int]
) – if a multiseries detection task is run, the maximum amount of time to wait for it to complete before giving up
- Returns:
properties –
A dict with three keys:
name : str, column name
eligibility : str, reason for column eligibility
isEligible : bool, is column eligible as cross-series group-by
- Return type:
dict
- get_multicategorical_histogram()
Retrieve multicategorical histogram for this feature
Added in version v2.24.
- Return type:
- Raises:
datarobot.errors.InvalidUsageError – if this method is called on a unsuited feature
ValueError – if no multilabel_insights_key is present for this feature
- get_pairwise_correlations()
Retrieve pairwise label correlation for multicategorical features
Added in version v2.24.
- Return type:
- Raises:
datarobot.errors.InvalidUsageError – if this method is called on a unsuited feature
ValueError – if no multilabel_insights_key is present for this feature
- get_pairwise_joint_probabilities()
Retrieve pairwise label joint probabilities for multicategorical features
Added in version v2.24.
- Return type:
- Raises:
datarobot.errors.InvalidUsageError – if this method is called on a unsuited feature
ValueError – if no multilabel_insights_key is present for this feature
- get_pairwise_conditional_probabilities()
Retrieve pairwise label conditional probabilities for multicategorical features
Added in version v2.24.
- Return type:
- Raises:
datarobot.errors.InvalidUsageError – if this method is called on a unsuited feature
ValueError – if no multilabel_insights_key is present for this feature
- classmethod from_data(data)
Instantiate an object of this class using a dict.
- Parameters:
data (
dict
) – Correctly snake_cased keys and their values.- Return type:
TypeVar
(T
, bound= APIObject)
- classmethod from_server_data(data, keep_attrs=None)
Instantiate an object of this class using the data directly from the server, meaning that the keys may have the wrong camel casing
- Parameters:
data (
dict
) – The directly translated dict of JSON from the server. No casing fixes have taken placekeep_attrs (
iterable
) – List, set or tuple of the dotted namespace notations for attributes to keep within the object structure even if their values are None
- Return type:
TypeVar
(T
, bound= APIObject)
- get_histogram(bin_limit=None)
Retrieve a feature histogram
- Parameters:
bin_limit (
int
orNone
) – Desired max number of histogram bins. If omitted, by default endpoint will use 60.- Returns:
featureHistogram – The requested histogram with desired number or bins
- Return type:
- class datarobot.models.ModelingFeature
A feature used for modeling
In time series projects, a new set of modeling features is created after setting the partitioning options. These features are automatically derived from those in the project’s dataset and are the features used for modeling. Modeling features are only accessible once the target and partitioning options have been set. In projects that don’t use time series modeling, once the target has been set, ModelingFeatures and Features will behave the same.
For more information about input and modeling features, see the time series documentation.
As with the
Feature
object, the min, max, `mean, median, and std_dev attributes provide information about the distribution of the feature in the EDA sample data. For non-numeric features, they will be None. For features where the summary statistics are available, they will be in a format compatible with the data type, i.e. date type features will have their summary statistics expressed as ISO-8601 formatted date strings.- Variables:
project_id (
str
) – the id of the project the feature belongs toname (
str
) – the name of the featurefeature_type (
str
) – the type of the feature, e.g. ‘Categorical’, ‘Text’importance (
float
orNone
) – numeric measure of the strength of relationship between the feature and target (independent of any model or other features); may be None for non-modeling features such as partition columnslow_information (
bool
) – whether a feature is considered too uninformative for modeling (e.g. because it has too few values)unique_count (
int
) – number of unique valuesna_count (
int
orNone
) – number of missing valuesdate_format (
str
orNone
) – For Date features, the date format string for how this feature was interpreted, compatible with https://docs.python.org/2/library/time.html#time.strftime . For other feature types, None.min (
str
,int
,float
, orNone
) – The minimum value of the source data in the EDA samplemax (
str
,int
,float
, orNone
) – The maximum value of the source data in the EDA samplemean (
str
,int
,or
,float
) – The arithmetic mean of the source data in the EDA samplemedian (
str
,int
,float
, orNone
) – The median of the source data in the EDA samplestd_dev (
str
,int
,float
, orNone
) – The standard deviation of the source data in the EDA sampleparent_feature_names (
List[str]
) – A list of the names of input features used to derive this modeling feature. In cases where the input features and modeling features are the same, this will simply contain the feature’s name. Note that if a derived feature was used to create this modeling feature, the values here will not necessarily correspond to the features that must be supplied at prediction time.key_summary (
list
ofdict
) –Statistics for top 50 keys (truncated to 103 characters) of Summarized Categorical column example:
{‘key’:’DataRobot’, ‘summary’:{‘min’:0, ‘max’:29815.0, ‘stdDev’:6498.029, ‘mean’:1490.75, ‘median’:0.0, ‘pctRows’:5.0}}
- where,
- key: string or None
name of the key
- summary: dict
statistics of the key
max: maximum value of the key. min: minimum value of the key. mean: mean value of the key. median: median value of the key. stdDev: standard deviation of the key. pctRows: percentage occurrence of key in the EDA sample of the feature.
- classmethod get(project_id, feature_name)
Retrieve a single modeling feature
- Parameters:
project_id (
str
) – The ID of the project the feature is associated with.feature_name (
str
) – The name of the feature to retrieve
- Returns:
feature – The requested feature
- Return type:
- class datarobot.models.DatasetFeature
A feature from a project’s dataset
These are features either included in the originally uploaded dataset or added to it via feature transformations.
The
min
,max
,mean
,median
, andstd_dev
attributes provide information about the distribution of the feature in the EDA sample data. For non-numeric features or features created prior to these summary statistics becoming available, they will be None. For features where the summary statistics are available, they will be in a format compatible with the data type, i.e. date type features will have their summary statistics expressed as ISO-8601 formatted date strings.- Variables:
id (
int
) – the id for the feature - note that name is used to reference the feature instead of iddataset_id (
str
) – the id of the dataset the feature belongs todataset_version_id (
str
) – the id of the dataset version the feature belongs toname (
str
) – the name of the featurefeature_type (
Optional[str]
) – the type of the feature, e.g. ‘Categorical’, ‘Text’low_information (
Optional[bool]
) – whether a feature is considered too uninformative for modeling (e.g. because it has too few values)unique_count (
Optional[int]
) – number of unique valuesna_count (
Optional[int]
) – number of missing valuesdate_format (
Optional[str]
) – For Date features, the date format string for how this feature was interpreted, compatible with https://docs.python.org/2/library/time.html#time.strftime . For other feature types, None.min (
str
,int
,Optional[float]
) – The minimum value of the source data in the EDA samplemax (
str
,int
,Optional[float]
) – The maximum value of the source data in the EDA samplemean (
str
,int
,Optional[float]
) – The arithmetic mean of the source data in the EDA samplemedian (
str
,int
,Optional[float]
) – The median of the source data in the EDA samplestd_dev (
str
,int
,Optional[float]
) – The standard deviation of the source data in the EDA sampletime_series_eligible (
Optional[bool]
) – Whether this feature can be used as the datetime partition column in a time series project.time_series_eligibility_reason (
Optional[str]
) – Why the feature is ineligible for the datetime partition column in a time series project, or ‘suitable’ when it is eligible.time_step (
Optional[int]
) – For time series eligible features, a positive integer determining the interval at which windows can be specified. If used as the datetime partition column on a time series project, the feature derivation and forecast windows must start and end at an integer multiple of this value. None for features that are not time series eligible.time_unit (
Optional[str]
) – For time series eligible features, the time unit covered by a single time step, e.g. ‘HOUR’, or None for features that are not time series eligible.target_leakage (
Optional[str]
) – Whether a feature is considered to have target leakage or not. A value of ‘SKIPPED_DETECTION’ indicates that target leakage detection was not run on the feature. ‘FALSE’ indicates no leakage, ‘MODERATE’ indicates a moderate risk of target leakage, and ‘HIGH_RISK’ indicates a high risk of target leakagetarget_leakage_reason (
string
, optional) – The descriptive text explaining the reason for target leakage, if any.
- get_histogram(bin_limit=None)
Retrieve a feature histogram
- Parameters:
bin_limit (
int
orNone
) – Desired max number of histogram bins. If omitted, by default endpoint will use 60.- Returns:
featureHistogram – The requested histogram with desired number or bins
- Return type:
- class datarobot.models.DatasetFeatureHistogram
- classmethod get(dataset_id, feature_name, bin_limit=None, key_name=None)
Retrieve a single feature histogram
- Parameters:
dataset_id (
str
) – The ID of the Dataset the feature is associated with.feature_name (
str
) – The name of the feature to retrievebin_limit (
int
orNone
) – Desired max number of histogram bins. If omitted, by default the endpoint will use 60.key_name (
string
orNone
) – (Only required for summarized categorical feature) Name of the top 50 keys for which plot to be retrieved
- Returns:
featureHistogram – The queried instance with plot attribute in it.
- Return type:
- class datarobot.models.FeatureHistogram
- classmethod get(project_id, feature_name, bin_limit=None, key_name=None)
Retrieve a single feature histogram
- Parameters:
project_id (
str
) – The ID of the project the feature is associated with.feature_name (
str
) – The name of the feature to retrievebin_limit (
int
orNone
) – Desired max number of histogram bins. If omitted, by default endpoint will use 60.key_name (
string
orNone
) – (Only required for summarized categorical feature) Name of the top 50 keys for which plot to be retrieved
- Returns:
featureHistogram – The queried instance with plot attribute in it.
- Return type:
- class datarobot.models.InteractionFeature
Interaction feature data
Added in version v2.21.
- Variables:
rows (
int
) – Total number of rowssource_columns (
list(str)
) – names of two categorical features which were combined into this onebars (
list(dict)
) – dictionaries representing frequencies of each independent value from the source columnsbubbles (
list(dict)
) – dictionaries representing frequencies of each combined value in the interaction feature.
- classmethod get(project_id, feature_name)
Retrieve a single Interaction feature
- Parameters:
project_id (
str
) – The id of the project the feature belongs tofeature_name (
str
) – The name of the Interaction feature to retrieve
- Returns:
feature – The queried instance
- Return type:
- class datarobot.models.MulticategoricalHistogram
Histogram for Multicategorical feature.
Added in version v2.24.
Notes
HistogramValues
contains:values.[].label
: string - Label namevalues.[].plot
: list - Histogram for labelvalues.[].plot.[].label_relevance
: int - Label relevance valuevalues.[].plot.[].row_count
: int - Row count where label has given relevancevalues.[].plot.[].row_pct
: float - Percentage of rows where label has given relevance
- Variables:
feature_name (
str
) – Name of the featurevalues (
list(dict)
) – List of Histogram values with a schema described asHistogramValues
- classmethod get(multilabel_insights_key)
Retrieves multicategorical histogram
You might find it more convenient to use
Feature.get_multicategorical_histogram
instead.- Parameters:
multilabel_insights_key (
string
) – Key for multilabel insights, unique for a project, feature and EDA stage combination. The multilabel_insights_key can be retrieved viaFeature.multilabel_insights_key
.- Returns:
The multicategorical histogram for multilabel_insights_key
- Return type:
- to_dataframe()
Convenience method to get all the information from this multicategorical_histogram instance in form of a
pandas.DataFrame
.- Returns:
Histogram information as a multicategorical_histogram. The dataframe will contain these columns: feature_name, label, label_relevance, row_count and row_pct
- Return type:
pandas.DataFrame
- class datarobot.models.PairwiseCorrelations
Correlation of label pairs for multicategorical feature.
Added in version v2.24.
Notes
CorrelationValues
contain:values.[].label_configuration
: list of length 2 - Configuration of the label pairvalues.[].label_configuration.[].label
: str – Label namevalues.[].statistic_value
: float – Statistic value
- Variables:
feature_name (
str
) – Name of the featurevalues (
list(dict)
) – List of correlation values with a schema described asCorrelationValues
statistic_dataframe (
pandas.DataFrame
) – Correlation values for all label pairs as a DataFrame
- classmethod get(multilabel_insights_key)
Retrieves pairwise correlations
You might find it more convenient to use
Feature.get_pairwise_correlations
instead.- Parameters:
multilabel_insights_key (
string
) – Key for multilabel insights, unique for a project, feature and EDA stage combination. The multilabel_insights_key can be retrieved viaFeature.multilabel_insights_key
.- Returns:
The pairwise label correlations
- Return type:
- as_dataframe()
The pairwise label correlations as a (num_labels x num_labels) DataFrame.
- Returns:
The pairwise label correlations. Index and column names allow the interpretation of the values.
- Return type:
pandas.DataFrame
- class datarobot.models.PairwiseJointProbabilities
Joint probabilities of label pairs for multicategorical feature.
Added in version v2.24.
Notes
ProbabilityValues
contain:values.[].label_configuration
: list of length 2 - Configuration of the label pairvalues.[].label_configuration.[].relevance
: int – 0 for absence of the labels, 1 for the presence of labelsvalues.[].label_configuration.[].label
: str – Label namevalues.[].statistic_value
: float – Statistic value
- Variables:
feature_name (
str
) – Name of the featurevalues (
list(dict)
) – List of joint probability values with a schema described asProbabilityValues
statistic_dataframes (
dict(pandas.DataFrame)
) –Joint Probability values as DataFrames for different relevance combinations.
E.g. The probability P(A=0,B=1) can be retrieved via:
pairwise_joint_probabilities.statistic_dataframes[(0,1)].loc['A', 'B']
- classmethod get(multilabel_insights_key)
Retrieves pairwise joint probabilities
You might find it more convenient to use
Feature.get_pairwise_joint_probabilities
instead.- Parameters:
multilabel_insights_key (
string
) – Key for multilabel insights, unique for a project, feature and EDA stage combination. The multilabel_insights_key can be retrieved viaFeature.multilabel_insights_key
.- Returns:
The pairwise joint probabilities
- Return type:
- as_dataframe(relevance_configuration)
Joint probabilities of label pairs as a (num_labels x num_labels) DataFrame.
- Parameters:
relevance_configuration (
tuple
oflength 2
) –Valid options are (0, 0), (0, 1), (1, 0) and (1, 1). Values of 0 indicate absence of labels and 1 indicates presence of labels. The first value describes the presence for the labels in axis=0 and the second value describes the presence for the labels in axis=1.
For example the matrix values for a relevance configuration of (0, 1) describe the probabilities of absent labels in the index axis and present labels in the column axis.
E.g. The probability P(A=0,B=1) can be retrieved via:
pairwise_joint_probabilities.as_dataframe((0,1)).loc['A', 'B']
- Returns:
The joint probabilities for the requested
relevance_configuration
. Index and column names allow the interpretation of the values.- Return type:
pandas.DataFrame
- class datarobot.models.PairwiseConditionalProbabilities
Conditional probabilities of label pairs for multicategorical feature.
Added in version v2.24.
Notes
ProbabilityValues
contain:values.[].label_configuration
: list of length 2 - Configuration of the label pairvalues.[].label_configuration.[].relevance
: int – 0 for absence of the labels, 1 for the presence of labelsvalues.[].label_configuration.[].label
: str – Label namevalues.[].statistic_value
: float – Statistic value
- Variables:
feature_name (
str
) – Name of the featurevalues (
list(dict)
) – List of conditional probability values with a schema described asProbabilityValues
statistic_dataframes (
dict(pandas.DataFrame)
) –Conditional Probability values as DataFrames for different relevance combinations. The label names in the columns are the events, on which we condition. The label names in the index are the events whose conditional probability given the indexes is in the dataframe.
E.g. The probability P(A=0|B=1) can be retrieved via:
pairwise_conditional_probabilities.statistic_dataframes[(0,1)].loc['A', 'B']
- classmethod get(multilabel_insights_key)
Retrieves pairwise conditional probabilities
You might find it more convenient to use
Feature.get_pairwise_conditional_probabilities
instead.- Parameters:
multilabel_insights_key (
string
) – Key for multilabel insights, unique for a project, feature and EDA stage combination. The multilabel_insights_key can be retrieved viaFeature.multilabel_insights_key
.- Returns:
The pairwise conditional probabilities
- Return type:
- as_dataframe(relevance_configuration)
Conditional probabilities of label pairs as a (num_labels x num_labels) DataFrame. The label names in the columns are the events, on which we condition. The label names in the index are the events whose conditional probability given the indexes is in the dataframe.
E.g. The probability P(A=0|B=1) can be retrieved via:
pairwise_conditional_probabilities.as_dataframe((0, 1)).loc['A', 'B']
- Parameters:
relevance_configuration (
tuple
oflength 2
) –Valid options are (0, 0), (0, 1), (1, 0) and (1, 1). Values of 0 indicate absence of labels and 1 indicates presence of labels. The first value describes the presence for the labels in axis=0 and the second value describes the presence for the labels in axis=1.
For example the matrix values for a relevance configuration of (0, 1) describe the probabilities of absent labels in the index axis given the presence of labels in the column axis.
- Returns:
The conditional probabilities for the requested
relevance_configuration
. Index and column names allow the interpretation of the values.- Return type:
pandas.DataFrame
Restoring Discarded Features
- class datarobot.models.restore_discarded_features.DiscardedFeaturesInfo
An object containing information about time series features which were reduced during time series feature generation process. These features can be restored back to the project. They will be included into All Time Series Features and can be used to create new feature lists.
Added in version v2.27.
- Variables:
total_restore_limit (
int
) – The total limit indicating how many features can be restored in this project.remaining_restore_limit (
int
) – The remaining available number of the features which can be restored in this project.features (
list
ofstrings
) – Discarded features which can be restored.count (
int
) – Discarded features count.
- classmethod restore(project_id, features_to_restore, max_wait=600)
Restore discarded during time series feature generation process features back to the project. After restoration features will be included into All Time Series Features.
Added in version v2.27.
- Parameters:
project_id (
string
)features_to_restore (
list
ofstrings
) – List of the feature names to restoremax_wait (
Optional[int]
) – max time to wait for features to be restored. Defaults to 10 min
- Returns:
status – information about features which were restored and which were not.
- Return type:
- classmethod retrieve(project_id)
Retrieve the discarded features information for a given project.
Added in version v2.27.
- Parameters:
project_id (
string
)- Returns:
info – information about features which were discarded during feature generation process and limits how many features can be restored.
- Return type:
- class datarobot.models.restore_discarded_features.FeatureRestorationStatus
Status of the feature restoration process.
Added in version v2.27.
- Variables:
warnings (
list
ofstrings
) – Warnings generated for those features which failed to restoreremaining_restore_limit (
int
) – The remaining available number of the features which can be restored in this project.restored_features (
list
ofstrings
) – Features which were restored