streamline.modeling.basemodel module

class streamline.modeling.basemodel.BaseModel(model, model_name, cv_folds=3, scoring_metric='balanced_accuracy', metric_direction='maximize', random_state=None, cv=None, sampler=None, n_jobs=None)[source]

Bases: object

Base Model Class for all ML Models

Parameters:
  • model

  • model_name

  • cv_folds

  • scoring_metric

  • metric_direction

  • random_state

  • cv

  • sampler

  • n_jobs

feature_importance()[source]

Unimplemented feature importance function stub

fit(x_train, y_train, n_trails, timeout, feature_names=None)[source]

Caller function to optimize

hyper_eval()[source]

Hyper eval for objective function Returns: Returns hyper eval for objective function

model_evaluation(x_test, y_test)[source]

Runs commands to gather all evaluations for later summaries and plots.

objective(trial, params=None)[source]

Unimplemented objective function stub, needs to be overridden :param trial: optuna trial object :param params: dict of optional params or None

optimize(x_train, y_train, n_trails, timeout, feature_names=None)[source]

Common model optimization function

Parameters:
  • x_train – train data

  • y_train – label data

  • n_trails – number of optuna trials

  • timeout – maximum time for optuna trial timeout

  • feature_names – header/name of features

predict(x_in)[source]

Function to predict with trained model :param x_in: input data

Returns: predictions y_pred