atm.classifier module

Classes

Model(method, params, judgment_metric, …)

This class contains everything needed to run an end-to-end ATM classifier pipeline.

class atm.classifier.Model(method, params, judgment_metric, class_column, testing_ratio=0.3, verbose_metrics=False)[source]

Bases: object

This class contains everything needed to run an end-to-end ATM classifier pipeline. It is initialized with a set of parameters and trained like a normal sklearn model. This class can be pickled and saved to disk, then unpickled outside of ATM and used to classify new datasets.

Attributes

ATM_KEYS

list() -> new empty list

MINMAX

str(object=’‘) -> str

N_FOLDS

int(x=0) -> integer

PCA

str(object=’‘) -> str

PCA_DIMS

str(object=’‘) -> str

SCALE

str(object=’‘) -> str

WHITEN

str(object=’‘) -> str

Methods

load(path)

Loads a saved Model instance from a path.

predict(data)

Generate predictions from new data.

save(path[, force])

Save this Model using pickle.

train_test(dataset)

Train and test this model using Cross Validation and Holdout.

ATM_KEYS = ['_scale', '_whiten', '_scale_minmax', '_pca', '_pca_dimensions']
MINMAX = '_scale_minmax'
N_FOLDS = 5
PCA = '_pca'
PCA_DIMS = '_pca_dimensions'
SCALE = '_scale'
WHITEN = '_whiten'
classmethod load(path)[source]

Loads a saved Model instance from a path.

Parameters

path (str) – path where the model is saved.

Returns

New model instance.

Return type

Model

predict(data)[source]

Generate predictions from new data.

Parameters

data (pandas.DataFrame) – Data for which to predict classes

Returns

Vector of predictions

Return type

pandas.Series

save(path, force=False)[source]

Save this Model using pickle.

Parameters
  • path (str) – Path where the model should be saved.

  • force (bool) – If True, overwrite the model if it already exists.

train_test(dataset)[source]

Train and test this model using Cross Validation and Holdout.

Parameters

dataset (Dataset) – Dataset object from database.

Returns

Dictionary containing:
  • cv (list): The cross validation scores array

  • test (dict): The test scores dictionary

Return type

dict