atm.worker module

Exceptions

ClassifierError

Classes

Worker(database, datarun[, save_files, …])

exception atm.worker.ClassifierError[source]

Bases: Exception

class atm.worker.Worker(database, datarun, save_files=True, cloud_mode=False, aws_access_key=None, aws_secret_key=None, s3_bucket=None, s3_folder=None, models_dir='models', metrics_dir='metrics', verbose_metrics=False)[source]

Bases: object

Methods

is_datarun_finished()

Check to see whether the datarun is finished.

load_selector()

Load and initialize the BTB class which will be responsible for selecting hyperpartitions.

load_tuner()

Load, but don’t initialize, the BTB class which will be responsible for choosing non-hyperpartition hyperparameter values (a subclass of Tuner).

run_classifier([hyperpartition_id])

Choose hyperparameters, then use them to test and save a Classifier.

save_classifier(classifier_id, model, metrics)

Update a classifier with metrics and model information and mark it as

save_classifier_cloud(local_model_path, …)

Save a classifier to the S3 bucket supplied on __init__.

select_hyperpartition()

Use the hyperpartition selection method specified by our datarun to choose a hyperpartition of hyperparameters from the ModelHub.

test_classifier(method, params)

Given a set of fully-qualified hyperparameters, create and test a classifier model.

tune_hyperparameters(hyperpartition)

Use the hyperparameter tuning method specified by our datarun to choose a set of hyperparameters from the potential space.

is_datarun_finished()[source]

Check to see whether the datarun is finished. This could be due to the budget being exhausted or due to hyperparameter gridding being done.

load_selector()[source]

Load and initialize the BTB class which will be responsible for selecting hyperpartitions.

load_tuner()[source]

Load, but don’t initialize, the BTB class which will be responsible for choosing non-hyperpartition hyperparameter values (a subclass of Tuner). The tuner must be initialized with information about the hyperpartition, so it cannot be created until later.

run_classifier(hyperpartition_id=None)[source]

Choose hyperparameters, then use them to test and save a Classifier.

save_classifier(classifier_id, model, metrics)[source]

Update a classifier with metrics and model information and mark it as “complete”

classifier_id: ID of the classifier to save

model: Model object containing a serializable representation of the

final model generated by this classifier.

metrics: Dictionary containing cross-validation and test metrics data

for the model.

save_classifier_cloud(local_model_path, local_metric_path, delete_local=False)[source]

Save a classifier to the S3 bucket supplied on __init__. Saves a serialized representaion of the model as well as a detailed set of metrics.

local_model_path: path to serialized model in the local file system local_metric_path: path to serialized metrics in the local file system

select_hyperpartition()[source]

Use the hyperpartition selection method specified by our datarun to choose a hyperpartition of hyperparameters from the ModelHub. Only consider partitions for which gridding is not complete.

test_classifier(method, params)[source]

Given a set of fully-qualified hyperparameters, create and test a classifier model. Returns: Model object and metrics dictionary

tune_hyperparameters(hyperpartition)[source]

Use the hyperparameter tuning method specified by our datarun to choose a set of hyperparameters from the potential space.