Prediction

class previsionio.prediction.DeploymentPrediction(_id: str, project_id: str, deployment_id: str, state: str = 'running', main_model_id: str = None, challenger_model_id: str = None, filename: str = None, **kwargs)

Bases: previsionio.api_resource.ApiResource

A prediction object that represents a deployed experiment bulk prediction resource which can be explored on the Prevision.io platform.

download(path: str = None, directoy_path: str = None, extension: str = 'zip')

Download deployment prediction file.

Parameters:
  • path (str, optional) – Target full local path
  • directoy_path (str, optional) – Target local directory path (if none is provided, the current working directory is used)
  • extension (str, optional) – possible extensions: zip, parquet, csv
Returns:

Path the data was downloaded to

Return type:

str

Raises:

PrevisionException – If prediction does not exist or if there was another error fetching or parsing data

classmethod from_id(_id: str) → previsionio.prediction.DeploymentPrediction

Get a prediction from the platform by its unique id.

Parameters:_id (str) – Unique id of the deployed experiment bulk prediction to retrieve
Returns:The fetched prediction
Return type:DeploymentPrediction
Raises:PrevisionException – Any error while fetching data from the platform or parsing result
get_challenger_result()

Get the prediction result of the challenger model.

Returns:Prediction results dataframe
Return type:pd.DataFrame
Raises:PrevisionException – Any error while fetching data from the platform or parsing result
get_result()

Get the prediction result of the main model.

Returns:Prediction results dataframe
Return type:pd.DataFrame
Raises:PrevisionException – Any error while fetching data from the platform or parsing result
class previsionio.prediction.ValidationPrediction(_id: str, experiment_id: str, experiment_version_id: str, project_id: str, state: str = 'running', model_id: str = None, dataset_id: str = None, filename: str = None, missing_columns: List = None, score: float = None, duration: float = None, predictions_count: int = None, **kwargs)

Bases: previsionio.api_resource.ApiResource

A prediction object that represents an experiment bulk prediction resource which can be explored on the Prevision.io platform.

delete()

Delete a prediction from the platform by its unique id.

Raises:
  • PrevisionException – If the prediction images does not exist
  • requests.exceptions.ConnectionError – Error processing the request
download(path: str = None, directoy_path: str = None, extension: str = 'zip')

Download validation prediction file.

Parameters:
  • path (str, optional) – Target full local path
  • directoy_path (str, optional) – Target local directory path (if none is provided, the current working directory is used)
  • extension (str, optional) – possible extensions: zip, parquet, csv
Returns:

Path the data was downloaded to

Return type:

str

Raises:

PrevisionException – If prediction does not exist or if there was another error fetching or parsing data

classmethod from_id(_id: str) → previsionio.prediction.ValidationPrediction

Get a prediction from the platform by its unique id.

Parameters:_id (str) – Unique id of the experiment bulk prediction to retrieve
Returns:The fetched prediction
Return type:ValidationPrediction
Raises:PrevisionException – Any error while fetching data from the platform or parsing result
get_result()

Get the prediction result.

Returns:Prediction results dataframe
Return type:pd.DataFrame
Raises:PrevisionException – Any error while fetching data from the platform or parsing result