modep_client package

Submodules

modep_client.automl module

class modep_client.automl.FrameworkFlights(client: modep_client.client.Client)[source]

Bases: object

Initialize the FrameworkFlights class. A Flight is a set of AutoML frameworks trained on the same data for comparison purposes.

Parameters:client – A modep_client.client.Client object
delete(id)[source]

Delete a flight by id

Returns:A dictionary containing deletion information
get(id)[source]

Get a flight by id

Returns:A dictionary containing the flight
list()[source]

List all flights

Returns:A pandas.DataFrame containing the flights
stop(id)[source]

Stop a flight by id

Returns:A dictionary containing stopping information
train(framework_names: List[str], train_ids: Union[str, List[str]], test_ids: Union[str, List[str]], target: str, max_runtime_seconds: int)[source]

Start a job to train an AutoML framework flight.

Parameters:
  • framework_names (str or list of str) – A list of framework names to train. If empty, then all frameworks are trained. Use modep_client.frameworks.Frameworks.info() to get a list of available frameworks. Available ones are AutoGluon, AutoGluon_bestquality, autosklearn, autosklearn2, AutoWEKA, constantpredictor, DecisionTree, flaml, GAMA, H2OAutoML, hyperoptsklearn, mljarsupervised, mljarsupervised_compete, MLNet, RandomForest, TPOT, TunedRandomForest.
  • train_ids (list) – The ids of the dataset(s) to train on
  • test_ids (list) – The ids of the dataset(s) to test on
  • target (str) – The name of the target column
  • max_runtime_seconds (int) – The maximum amount of time in seconds to train per dataset(s)
Returns:

A modep_client.tasks.BaseTask object

wait(id)[source]

Wait for a flight to finish while printing out a DataFrame of the results. This version is for running in a Jupyter notebook, for the terminal version, see wait_terminal().

Parameters:id (str) – The id of the flight to wait for
wait_terminal(id)[source]

Wait for a flight to finish while printing out a DataFrame of the results. This version is for running in a terminal. Use wait() if you are running in a Jupyter notebook.

Parameters:id (str) – The id of the flight to wait for
class modep_client.automl.Frameworks(client: modep_client.client.Client)[source]

Bases: object

Initialize the Framworks class

Parameters:client – A modep_client.client.Client object
delete(id)[source]

Delete an AutoML training run

Parameters:id (str) – The id of the training run to delete
Returns:A dictionary containing info about the deletion
get(id: str)[source]

Get an AutoML training run by id

Parameters:id (str) – The id of the training run
Returns:A dictionary containing the training run
get_output(framework_id, target_dir=None)[source]

Get the output files generated by the AutoML training run.

Parameters:
  • framework_id (str) – The id of the training run
  • target_dir (str) – The local directory to download the files to. If None, the files are downloaded to a temp directory.
get_predictions(predictions_id)[source]

Get the predictions created by an AutoML training or prediction job

Parameters:predictions_id (str) – The id of the predictions to get
Returns:A dictionary containing the predictions
info()[source]

Get info about the AutoML frameworks available through the API

Returns:A pandas.DataFrame with one row for each framework
list()[source]

List all AutoML framework training runs

Returns:A pandas.DataFrame with one row for each training run
predict(framework_id, dataset_id)[source]

Start a job to get predictions from an AutoML framework on a new dataset

Parameters:
  • framework_id (str) – The id of the framework to use
  • dataset_id (str) – The id of the dataset to predict on
Returns:

A modep_client.tasks.BaseTask object

print_log(framework_id, target_dir=None)[source]

Print the logs generated by the AutoML training run.

Parameters:
  • framework_id (str) – The id of the training run
  • target_dir (str) – The local directory to download the files to. If None, the files are downloaded to a temp directory.
stop(id)[source]

Stop an AutoML training run

Parameters:id (str) – The id of the training run to stop
Returns:A dictionary containing the training run
train(framework_name: str, train_ids: Union[str, List[str]], test_ids: Union[str, List[str]], target: str, max_runtime_seconds: int)[source]

Train an AutoML framework

Parameters:
  • framework_name (str) – The name of the framework (ie. AutoGluon, AutoGluon_bestquality, autosklearn, autosklearn2, AutoWEKA, constantpredictor, DecisionTree, flaml, GAMA, H2OAutoML, hyperoptsklearn, mljarsupervised, mljarsupervised_compete, MLNet, RandomForest, TPOT, TunedRandomForest)
  • train_ids – The id(s) of dataset(s) to train on (ie. e1bc3d16b-6d67-43cd-af59-8d39d8cb2a02)
  • test_ids – The id(s) of dataset(s) to test on (ie. 1bc3d16b-6d67-43cd-af59-8d39d8cb2a02)
  • target (str) – The name of the target column in the training dataset(s)
  • max_runtime_seconds (int) – The maximum amount of time in seconds to train per dataset(s)
Returns:

A modep_client.tasks.BaseTask object

modep_client.client module

class modep_client.client.Client(api_key, url='https://modep.ai/v1/', ensure_https=True)[source]

Bases: object

Initialize a ModepClient object.

Parameters:
  • api_key (str) – Your API key from the modep.ai account page (https://modep.ai/account)
  • url (str) – The base URL of the modep.ai API
  • ensure_https (bool) – If True, will ensure that the URL starts with https
auth_header()[source]

Get the JWT authorization header

login()[source]

Login to the API

response_exception(response)[source]

Raise an exception from a response

modep_client.datasets module

class modep_client.datasets.Datasets(client: modep_client.client.Client)[source]

Bases: object

Initialize the Datasets class

Parameters:client – A modep_client.client.Client object
delete(dataset_id)[source]

Delete a dataset by id.

Parameters:id (str) – The id of the dataset
Returns:A dictionary containing information on the deletion
get(id: str)[source]

Get a dataset by id.

Parameters:id (str) – The id of the dataset
Returns:A dictionary for the dataset
list()[source]

List all datasets.

Returns:A list of dictionaries for each uploaded or public dataset
upload(dset: Union[str, pandas.core.frame.DataFrame], name: str, target: str = None, categorical_target: bool = True)[source]

Upload a tabular dataset.

Parameters:
  • dset (str or pandas.DataFrame) – either a path to a CSV file or DataFrame containing the data
  • name (str) – A name to give the dataset (ie. titanic-train or titanic-test)
  • target (str or None) – Optionally specify a target column for the dataset
  • categorical_target (bool) – True if the specified target column is categorical (for classification), otherwise set this to False for regression.

modep_client.tasks module

class modep_client.tasks.BaseTask(response, get_method)[source]

Bases: object

Initialize a task object, which monitors the status of a task.

Parameters:
  • response (dict) – The initial response from the server
  • get_method (function) – The method to use to get the task status
Returns:

the final response from the server once the task is complete

result()[source]

Get the result of the task. This will block until the task is complete.

Module contents

Top-level package for modep-client.