ballet.validation.base module

class ballet.validation.base.BaseCheck[source]

Bases: object

abstract check(obj)[source]

Check something and throw an exception if the thing is bad

Return type

None

do_check(obj)[source]

Do the check and return whether an exception was not thrown

Return type

bool

give_advice(feature)[source]

Description of how to resolve if the check fails

Return type

Optional[str]

class ballet.validation.base.BaseValidator[source]

Bases: object

Base class for a generic validator

abstract validate()[source]

Validate something and return whether validation succeeded

Return type

bool

class ballet.validation.base.FeatureAcceptanceMixin[source]

Bases: object

abstract judge()[source]

Judge whether feature should be accepted

Return type

bool

class ballet.validation.base.FeatureAccepter(X_df, y_df, X_df_val, y_val, features, candidate_feature)[source]

Bases: ballet.validation.base.FeatureAcceptanceMixin, ballet.validation.base.FeaturePerformanceEvaluator

Accept/reject a feature to the project based on its performance

class ballet.validation.base.FeaturePerformanceEvaluator(X_df, y_df, X_df_val, y_val, features, candidate_feature)[source]

Bases: object

Evaluate the performance of features from an ML point-of-view

Implementing classes should be clear about their support for missing targets, i.e. NaN values in y_val. For example, the subclass can raise an error indicating that it cannot be used for a problem, or it can choose to skip rows with missing values in the performance evaluation.

Parameters
  • X_df (DataFrame) – entities frame for fitting the features

  • y_df (Union[DataFrame, Series]) – targets frame/series for fitting the features

  • X_df_val (DataFrame) – entities frame for evaluating the features

  • y_val (ndarray) – target values for evaluating the features

  • features (Iterable[Feature]) – all collected features

  • candidate_feature (Feature) – the feature to evaluate

class ballet.validation.base.FeaturePruner(X_df, y_df, X_df_val, y_val, features, candidate_feature)[source]

Bases: ballet.validation.base.FeaturePruningMixin, ballet.validation.base.FeaturePerformanceEvaluator

Prune features after acceptance based on their performance

class ballet.validation.base.FeaturePruningMixin[source]

Bases: object

abstract prune()[source]

Prune existing features, returning list of features to remove

Return type

List[Feature]