Validators#

validate_feature_types(feature_types: dict[Any, str]) None[source]#

Validate the feature types dictionary.

Parameters:

feature_types (dict[Any, str]) – A dictionary mapping column names to their feature types.

Raises:

ValueError – If the feature types are not valid.

validate_scale_method(scale: str) None[source]#

Validate the scale method.

Parameters:

scale (str) – The scale method to validate.

Raises:

ValueError – If the scale method is not valid.

validate_missing_strategy(missing_strategy: str) None[source]#

Validate the missing strategy.

Parameters:

missing_strategy (str) – The missing strategy to validate.

Raises:

ValueError – If the missing strategy is not valid.

validate_categorical_ordinal_values_order(categorical_ordinal_values_order: dict[int | str, list[str]], feature_types: dict[int | str, str]) None[source]#

Validate whether all defined categorical ordinal columns have specified the order of their values.

Parameters:
  • categorical_ordinal_values_order (dict[int | str, list[str]]) – categorical ordinal values order to validate.

  • feature_types (dict[int | str, str]) – A dictionary mapping column names to their feature types.

Raises:

ValueError – If the categorical ordinal values order is not valid.

validate_categorical_ordinal_calculation_type(calculation_type: str) None[source]#

Validate the calculation type for categorical nominal features.

Parameters:

calculation_type (str) – The calculation type to validate.

Raises:

ValueError – If the calculation type is not valid.

validate_scale_window_and_type(scale_window: str | None, scale_window_type: str | None) None[source]#

Validate the scale window and it’s type at the same time.

Parameters:
  • scale_window (Optional[str]) – The scale window to validate.

  • scale_window_type (Optional[str]) – The scale window type to validate.

Raises:

ValueError – If the scale window is not valid.

validate_weights_type(weights: str | dict) None[source]#

Validate the weights type.

Parameters:

weights (str | dict) – The weights to validate.

Raises:

ValueError – If the weights type is not valid.

validate_k_neighbours(k_neighbours: int | None) None[source]#

Validate the k-neighbours type.

Parameters:

k_neighbours (int | None) – The k-neighbours to validate.

Raises:

ValueError – If the k-neighbours type is not valid.

validate_conditional_distances(conditional_distances: bool) None[source]#

Validate the conditional distances flag.

Parameters:

conditional_distances (bool) – Flag to validate

Raises:

ValueError – If conditional_distances flag different from bool

validate_conditional_distances_threshold_coeff(conditional_distances_threshold_coeff: int) None[source]#

Validate the conditional distances threshold coefficient.

Parameters:

conditional_distances_threshold_coeff (int) – Value of the threshold coefficient

Raises:

ValueError – If conditional_distances_threshold_coeff not an int or lower than 1.

validate_feature_types_for_conditional_distances(n_feats: int, p_cat: int) None[source]#

Validate the data passed to use with the conditional ditances.

Parameters:
  • n_feats (int) – Number of passed features

  • p_cat (int) – Number of categorical features

Raises:

ValueError – If there are either no categorical or no numerical features passed.