ClassImbalance#

class ClassImbalance[source]#

Check if a dataset is imbalanced by looking at the target variable distribution.

Parameters
n_top_labels: int, default: 5

Number of labels to show in display graph

ignore_nan: bool, default True

Whether to ignore NaN values in the target variable when counting the number of unique values.

__init__(n_top_labels: int = 5, ignore_nan: bool = True, **kwargs)[source]#
__new__(*args, **kwargs)#

Methods

ClassImbalance.add_condition(name, ...)

Add new condition function to the check.

ClassImbalance.add_condition_class_ratio_less_than([...])

Add condition - ratio between least to most frequent labels.

ClassImbalance.clean_conditions()

Remove all conditions from this check instance.

ClassImbalance.conditions_decision(result)

Run conditions on given result.

ClassImbalance.config([include_version])

Return check configuration (conditions' configuration not yet supported).

ClassImbalance.from_config(conf[, ...])

Return check object from a CheckConfig object.

ClassImbalance.from_json(conf[, version_unmatch])

Deserialize check instance from JSON string.

ClassImbalance.metadata([with_doc_link])

Return check metadata.

ClassImbalance.name()

Name of class in split camel case.

ClassImbalance.params([show_defaults])

Return parameters to show when printing the check.

ClassImbalance.remove_condition(index)

Remove given condition by index.

ClassImbalance.run(dataset[, model, ...])

Run check.

ClassImbalance.run_logic(context, dataset_kind)

Run the check.

ClassImbalance.to_json([indent])

Serialize check instance to JSON string.

Examples#