data_check_action_option#

Recommended action returned by a DataCheck.

Module Contents#

Classes Summary#

DataCheckActionOption

A recommended action option returned by a DataCheck.

DCAOParameterAllowedValuesType

Enum for data check action option parameter allowed values type.

DCAOParameterType

Enum for data check action option parameter type.

Contents#

class evalml.data_checks.data_check_action_option.DataCheckActionOption(action_code, data_check_name, parameters=None, metadata=None)[source]#

A recommended action option returned by a DataCheck.

It contains an action code that indicates what the action should be, a data check name that indicates what data check was used to generate the action, and parameters and metadata which can be used to further refine the action.

Parameters
  • action_code (DataCheckActionCode) – Action code associated with the action option.

  • data_check_name (str) – Name of the data check that produced this option.

  • parameters (dict) – Parameters associated with the action option. Defaults to None.

  • metadata (dict, optional) – Additional useful information associated with the action option. Defaults to None.

Examples

>>> parameters = {
...     "global_parameter_name": {
...         "parameter_type": "global",
...         "type": "float",
...         "default_value": 0.0,
...     },
...     "column_parameter_name": {
...         "parameter_type": "column",
...         "columns": {
...             "a": {
...                 "impute_strategy": {
...                     "categories": ["mean", "most_frequent"],
...                     "type": "category",
...                     "default_value": "mean",
...                 },
...             "constant_fill_value": {"type": "float", "default_value": 0},
...             },
...         },
...     },
... }
>>> data_check_action = DataCheckActionOption(DataCheckActionCode.DROP_COL, None, metadata={}, parameters=parameters)

Methods

convert_dict_to_option

Convert a dictionary into a DataCheckActionOption.

get_action_from_defaults

Returns an action based on the defaults parameters.

to_dict

Return a dictionary form of the data check action option.

static convert_dict_to_option(action_dict)[source]#

Convert a dictionary into a DataCheckActionOption.

Parameters

action_dict – Dictionary to convert into an action option. Should have keys “code”, “data_check_name”, and “metadata”.

Raises

ValueError – If input dictionary does not have keys code and metadata and if the metadata dictionary does not have keys columns and rows.

Returns

DataCheckActionOption object from the input dictionary.

get_action_from_defaults(self)[source]#

Returns an action based on the defaults parameters.

Returns

An based on the defaults parameters the option.

Return type

DataCheckAction

to_dict(self)[source]#

Return a dictionary form of the data check action option.

class evalml.data_checks.data_check_action_option.DCAOParameterAllowedValuesType[source]#

Enum for data check action option parameter allowed values type.

Attributes

CATEGORICAL

Categorical allowed values type. Parameters that have a set of allowed values.

NUMERICAL

Numerical allowed values type. Parameters that have a range of allowed values.

Methods

name

The name of the Enum member.

value

The value of the Enum member.

name(self)#

The name of the Enum member.

value(self)#

The value of the Enum member.

class evalml.data_checks.data_check_action_option.DCAOParameterType[source]#

Enum for data check action option parameter type.

Attributes

COLUMN

Column parameter type. Parameters that apply to a specific column in the data set.

GLOBAL

Global parameter type. Parameters that apply to the entire data set.

Methods

all_parameter_types

Get a list of all defined parameter types.

handle_dcao_parameter_type

Handles the data check action option parameter type by either returning the DCAOParameterType enum or converting from a str.

name

The name of the Enum member.

value

The value of the Enum member.

all_parameter_types(cls)#

Get a list of all defined parameter types.

Returns

List of all defined parameter types.

Return type

list(DCAOParameterType)

static handle_dcao_parameter_type(dcao_parameter_type)[source]#

Handles the data check action option parameter type by either returning the DCAOParameterType enum or converting from a str.

Parameters

dcao_parameter_type (str or DCAOParameterType) – Data check action option parameter type that needs to be handled.

Returns

DCAOParameterType enum

Raises
  • KeyError – If input is not a valid DCAOParameterType enum value.

  • ValueError – If input is not a string or DCAOParameterType object.

name(self)#

The name of the Enum member.

value(self)#

The value of the Enum member.