Experiment Deployment

class previsionio.experiment_deployment.ExperimentDeployment(_id: str, name: str, experiment_id, current_version, versions, deploy_state, current_type_violation_policy, access_type, project_id, training_type, models, url=None, **kwargs)

ExperimentDeployment objects represent experiment deployment resource that will be explored by Prevision.io platform.

create_api_key()

Create an api key of the experiment deployment from the actual [client] workspace.

Raises:
  • PrevisionException – If the dataset does not exist
  • requests.exceptions.ConnectionError – Error processing the request
delete()

Delete an experiment deployment from the actual [client] workspace.

Raises:
  • PrevisionException – If the experiment deployment does not exist
  • requests.exceptions.ConnectionError – Error processing the request
classmethod from_id(_id: str)

Get a deployed experiment from the platform by its unique id.

Parameters:_id (str) – Unique id of the experiment version to retrieve
Returns:Fetched deployed experiment
Return type:ExperimentDeployment
Raises:PrevisionException – Any error while fetching data from the platform or parsing result
get_api_keys()

Fetch the api keys client id and cient secret of the experiment deployment from the actual [client] workspace.

Raises:
  • PrevisionException – If the dataset does not exist
  • requests.exceptions.ConnectionError – Error processing the request
classmethod list(project_id: str, all: bool = True) → List[previsionio.experiment_deployment.ExperimentDeployment]

List all the available experiment in the current active [client] workspace.

Warning

Contrary to the parent list() function, this method returns actual ExperimentDeployment objects rather than plain dictionaries with the corresponding data.

Parameters:
  • project_id (str) – project id
  • all (boolean, optional) – Whether to force the SDK to load all items of the given type (by calling the paginated API several times). Else, the query will only return the first page of result.
Returns:

Fetched dataset objects

Return type:

list(ExperimentDeployment)

list_predictions() → List[previsionio.prediction.DeploymentPrediction]

List all the available predictions in the current active [client] workspace.

Returns:Fetched deployed predictions objects
Return type:list(DeploymentPrediction)
new_version(name: str, main_model, challenger_model=None)

Create a new experiment deployment version.

Parameters:
  • name (str) – experiment deployment name
  • main_model – main model
  • challenger_model (optional) – challenger model. main and challenger models should be in the same experiment
Returns:

The registered experiment deployment object in the current project

Return type:

ExperimentDeployment

Raises:
  • PrevisionException – Any error while creating experiment deployment to the platform or parsing the result
  • Exception – For any other unknown error
predict_from_dataset(dataset: previsionio.dataset.Dataset) → previsionio.prediction.DeploymentPrediction

Make a prediction for a dataset stored in the current active [client] workspace (using the current SDK dataset object).

Parameters:dataset (Dataset) – Dataset resource to make a prediction for
Returns:The registered prediction object in the current workspace
Return type:DeploymentPrediction
wait_until(condition, timeout: float = 3600.0)

Wait until condition is fulfilled, then break.

Parameters:
  • (func (condition) – (BaseExperimentVersion) -> bool.): Function to use to check the break condition
  • raise_on_error (bool, optional) – If true then the function will stop on error, otherwise it will continue waiting (default: True)
  • timeout (float, optional) – Maximal amount of time to wait before forcing exit

Example:

experiment.wait_until(lambda experimentv: len(experimentv.models) > 3)
Raises:PrevisionException – If the resource could not be fetched or there was a timeout.