openprotein.api.train#

Train model(s) on your measured properties to enable predictions for new sequences! These workflows can additionally perform cross-validation on your models to estimate uncertainty. A trained model is required before you can utilize predict or design functions.

endpoints#

class openprotein.api.train.TrainingAPI[source]#

API interface for calling Train endpoints

__init__(session)[source]#
Parameters:

session (APISession)

create_training_job(assaydataset, measurement_name, model_name='', force_preprocess=False)[source]#

Create a training job on your data.

This function validates the inputs, formats the data, and sends the job.

Parameters:
  • assaydataset (AssayDataset) – An AssayDataset object from which the assay_id is extracted.

  • measurement_name (str or List[str]) – The name(s) of the measurement(s) to be used in the training job.

  • model_name (str, optional) – The name to give the model.

  • force_preprocess (bool, optional) – If set to True, preprocessing is forced even if data already exists.

Returns:

A TrainFuture Job

Return type:

TrainFuture

Raises:
  • InvalidParameterError – If the assaydataset is not an AssayDataset object, If any measurement name provided does not exist in the AssayDataset, or if the AssayDataset has fewer than 3 data points.

  • HTTPError – If the request to the server fails.

get_training_results(job_id)[source]#

Get training results (e.g. loss etc).

Parameters:

job_id (str) – job_id to get

Returns:

A TrainFuture Job

Return type:

TrainFuture

Results#

class openprotein.api.train.TrainFuture[source]#

Future Job for manipulating results

__init__(session, job, assaymetadata=None)[source]#
Parameters:
  • session (APISession)

  • job (Job)

  • assaymetadata (AssayMetadata | None)

predict(sequences, model_ids=None)[source]#

Creates a predict job based on the training job.

Parameters:
  • sequences (List[str]) – The list of sequences to be used for the Predict job.

  • model_ids (List[str], optional) – The list of model ids to be used for Predict. Default is None.

Returns:

The job object representing the Predict job.

Return type:

PredictFuture

predict_single_site(sequence, model_ids=None)[source]#

Creates a new Predict job for single site mutation analysis with a trained model.

Parameters:
  • sequence (str) – The sequence for single site analysis.

  • train_job (Any) – The train job object representing the trained model.

  • model_ids (List[str], optional) – The list of model ids to be used for Predict. Default is None.

Returns:

  • PredictFuture – The job object representing the Predict job.

  • Creates a predict job based on the training job

Return type:

PredictFuture

class openprotein.api.predict.PredictFuture[source]#

Future Job for manipulating results

__init__(session, job, page_size=1000)[source]#
Parameters:
get(verbose=False)[source]#

Get all the results of the predict job.

Parameters:

verbose (bool, optional) – If True, print verbose output. Defaults False.

Raises:

APIError – If there is an issue with the API request.

Returns:

A list of predict objects representing the results.

Return type:

PredictJob