fusetools.ml_tools.Prep

class fusetools.ml_tools.Prep[source]

Bases: object

Functions for preparing data for machine learning tasks.

Methods

label_encode_df

Assigns an incremental number for each string value and then converts the new number to a float so we can add the missing value (NaNs) back in for later imputation.

make_model_feature_df

Creates Pandas DataFrame with cumulatively trained combined feature names, coefficients, absolute coefficients in order of trained together.

classmethod label_encode_df(df, col, col_new)[source]

Assigns an incremental number for each string value and then converts the new number to a float so we can add the missing value (NaNs) back in for later imputation.

Parameters
  • df – Pandas DataFrame with atleast one feature to encode.

  • col – Name of column to encode.

  • col_new – Name of new, encoded column.

Returns

Pandas DataFrame with new, encoded column.

classmethod make_model_feature_df(df, cat, model_list)[source]

Creates Pandas DataFrame with cumulatively trained combined feature names, coefficients, absolute coefficients in order of trained together.

Parameters
  • df – Pandas DataFrame of a fitted SckitLearn estimator’s features, coefficients absolute coefficients.

  • cat – Name of ScikitLearn estimator or self defines estimator type.

  • model_list – List of ScikitLearn estimators.

Returns

Pandas DataFrame with cumulatively trained combined feature names, coefficients, absolute coefficients and performance placeholders in order of trained together.