Model Client

class citrination_client.models.client.ModelsClient(api_key, webserver_host='https://citrination.com', suppress_warnings=False, proxies=None)

A client that encapsulates interactions with models on Citrination.

__init__(api_key, webserver_host='https://citrination.com', suppress_warnings=False, proxies=None)

Constructor.

check_predict_status(view_id, predict_request_id)

Returns a string indicating the status of the prediction job

Parameters
  • view_id – The data view id returned from data view create

  • predict_request_id – The id returned from predict

Returns

Status data, also includes results if state is finished

get_data_view_service_status(data_view_id)
Retrieves the status for all of the services associated with a data view:
  • predict

  • experimental_design

  • data_reports

  • model_reports

Parameters

data_view_id (str) – The ID number of the data view to which the run belongs, as a string

Returns

A DataViewStatus

Return type

DataViewStatus

get_design_run_results(data_view_id, run_uuid)

Retrieves the results of an existing designrun

Parameters
  • data_view_id (str) – The ID number of the data view to which the run belongs, as a string

  • run_uuid (str) – The UUID of the design run to retrieve results from

Returns

A DesignResults object

get_design_run_status(data_view_id, run_uuid)

Retrieves the status of an in progress or completed design run

Parameters
  • data_view_id (str) – The ID number of the data view to which the run belongs, as a string

  • run_uuid (str) – The UUID of the design run to retrieve status for

Returns

A ProcessStatus object

kill_design_run(data_view_id, run_uuid)

Kills an in progress experimental design run

Parameters
  • data_view_id (str) – The ID number of the data view to which the run belongs, as a string

  • run_uuid (str) – The UUID of the design run to kill

Returns

The UUID of the design run

predict(data_view_id, candidates, method='scalar', use_prior=True)

Predict endpoint. This simply wraps the async methods (submit and poll for status/results).

Parameters
  • data_view_id (str) – The ID of the data view to use for prediction

  • candidates (list of dicts) – A list of candidates to make predictions on

  • method (str ("scalar" or "scalar_from_distribution")) – Method for propagating predictions through model graphs. “scalar” uses linearized uncertainty propagation, whereas “scalar_from_distribution” still returns scalar predictions but uses sampling to propagate uncertainty without a linear approximation.

  • use_prior (bool) – Whether to apply prior values implied by the property descriptors

Returns

The results of the prediction

Return type

list of PredictionResult

retrain(dataview_id)

Start a model retraining :param dataview_id: The ID of the views :return:

submit_design_run(data_view_id, num_candidates, effort, target=None, constraints=[], sampler='Default')

Submits a new experimental design run.

Parameters
  • data_view_id (str) – The ID number of the data view to which the run belongs, as a string

  • num_candidates (int) – The number of candidates to return

  • target (:class:Target) – An :class:Target instance representing the design run optimization target

  • constraints (list of :class:BaseConstraint) – An array of design constraints (instances of objects which extend :class:BaseConstraint)

  • sampler (str) – The name of the sampler to use during the design run: either “Default” or “This view”

Returns

A DesignRun instance containing the UID of the new run

submit_predict_request(data_view_id, candidates, prediction_source='scalar', use_prior=True)

Submits an async prediction request.

Parameters
  • data_view_id – The id returned from create

  • candidates – Array of candidates

  • prediction_source – ‘scalar’ or ‘scalar_from_distribution’

  • use_prior – True to use prior prediction, otherwise False

Returns

Predict request Id (used to check status)

template_latest_version(model_path)

Get the latest version of a template :param model_path: path of the model, e.g. view_ml_N_1 for view ID N :return: template version

tsne(data_view_id)

Get the t-SNE projection, including responses and tags.

Parameters

data_view_id (int) – The ID of the data view to retrieve TSNE from

Returns

The TSNE analysis

Return type

Tsne