Project¶
-
class
previsionio.project.
Project
(_id: str, name: str, description: str = None, color: previsionio.project.ProjectColor = None, created_by: str = None, admins=[], contributors=[], viewers=[], pipelines_count: int = 0, experiments_count: int = 0, dataset_count: int = 0, **kwargs)¶ Bases:
previsionio.api_resource.ApiResource
,previsionio.api_resource.UniqueResourceMixin
A Project
Parameters: - _id (str) – Unique id of the project
- name (str) – Name of the project
- description (str, optional) – Description of the project
- color (ProjectColor, optional) – Color of the project
-
create_dataset
(name: str, datasource: previsionio.datasource.DataSource = None, file_name: str = None, dataframe: pandas.core.frame.DataFrame = None, **kwargs)¶ Register a new dataset in the workspace for further processing. You need to provide either a datasource, a file name or a dataframe (only one can be specified).
Note
To start a new experiment version on a dataset, it has to be already registred in your workspace.
Parameters: - name (str) – Registration name for the dataset
- datasource (
DataSource
, optional) – A DataSource object used to import a remote dataset (if you want to import a specific dataset from an existent database, you need a datasource connector (Connector
object) designed to point to the related data source) - file_name (str, optional) – Path to a file to upload as dataset
- dataframe (pd.DataFrame, optional) – A
pandas
dataframe containing the data to upload
Raises: Exception
– If more than one of the keyword argumentsdatasource
,file_name
,dataframe
was specifiedPrevisionException
– Error while creating the dataset on the platform
Returns: The registered dataset object in the current workspace.
Return type:
-
create_datasource
(connector: previsionio.connector.Connector, name: str, path: str = None, database: str = None, table: str = None, bucket: str = None, request: str = None, gCloud: previsionio.connector.GCloud = None)¶ Create a new datasource object on the platform.
Parameters: - connector (
Connector
) – Reference to the associated connector (the resource to go through to get a data snapshot) - name (str) – Name of the datasource
- path (str, optional) – Path to the file to fetch via the connector
- database (str, optional) – Name of the database to fetch data from via the connector
- table (str, optional) – Name of the table to fetch data from via the connector
- bucket (str, optional) – Name of the bucket to fetch data from via the connector
- gCloud (
GCloud
, optional) – Type of google cloud service - request (str, optional) – Direct SQL request to use with the connector to fetch data
Returns: The registered datasource object in the current project
Return type: Raises: PrevisionException
– Any error while uploading data to the platform or parsing the resultException
– For any other unknown error
- connector (
-
create_experiment_deployment
(name: str, main_model: previsionio.model.Model, challenger_model: previsionio.model.Model = None, type_violation_policy: str = 'best_effort', access_type: str = 'public') → previsionio.experiment_deployment.ExperimentDeployment¶ Create a new experiment deployment in the current project.
Parameters: - name (str) – experiment deployment name
- main_model (
Model
) – main model - challenger_model (
Model
, optional) – challenger model (main and challenger models should come from the same experiment) - type_violation_policy (str, optional) – best_effort/ strict
- access_type (str, optional) – public/ fine_grained/ private
Returns: Fetched experiment deployment object
Return type:
-
create_exporter
(connector: previsionio.connector.Connector, name: str, description: str = None, path: str = None, bucket: str = None, database: str = None, table: str = None, g_cloud: previsionio.connector.GCloud = None, write_mode: previsionio.exporter.ExporterWriteMode = <ExporterWriteMode.safe: 'safe'>)¶ Create a new exporter object on the platform.
Parameters: - connector (
Connector
) – Reference to the associated connector (the resource to go through to get a data snapshot) - name (str) – Name of the exporter
- description (str, optional) – Description of the exporter
- bucket (str, optional) – Bucket of the file to write on via the exporter
- path (str, optional) – Path to the file to write on via the exporter
- database (str, optional) – Name of the database to write on via the exporter
- table (str, optional) – Name of the table to write on via the exporter
- g_cloud (
GCloud
, optional) – Type of google cloud service - write_mode (
ExporterWriteMode
, optional) – Write mode
Returns: The registered exporter object in the current project
Return type: Raises: PrevisionException
– Any error while uploading data to the platform or parsing the resultException
– For any other unknown error
- connector (
-
create_external_classification
()¶ Create a tabular classification experiment version from external models
Parameters: - experiment_name (str) – Name of the experiment to create
- holdout_dataset (
Dataset
) – Reference to the holdout dataset object to use for as holdout dataset - target_column (str) – The name of the target column for this experiment version
- external_models (list(tuple)) –
The external models to add in the experiment version to create. Each tuple contains 3 items describing an external model as follows:
- The name you want to give to the model
- The path to the model in onnx format
- The path to a yaml file containing metadata about the model
- metric (
metrics.Classification
, optional) – Specific metric to use for the experiment (default:metrics.Classification.AUC
) - dataset (
Dataset
, optional) – Reference to the dataset object that has been used to train the model (default:None
) - experiment_version_description (str) – Description of the experiment version to create
Returns: Newly created ExternalExperimentVersion object
Return type: external_models.ExternalExperimentVersion
-
create_external_multiclassification
()¶ Create a tabular multiclassification experiment version from external models
Parameters: - experiment_name (str) – Name of the experiment to create
- holdout_dataset (
Dataset
) – Reference to the holdout dataset object to use for as holdout dataset - target_column (str) – The name of the target column for this experiment version
- external_models (list(tuple)) –
The external models to add in the experiment version to create. Each tuple contains 3 items describing an external model as follows:
- The name you want to give to the model
- The path to the model in onnx format
- The path to a yaml file containing metadata about the model
- metric (
metrics.MultiClassification
, optional) – Specific metric to use for the experiment (default:metrics.MultiClassification.log_loss
) - dataset (
Dataset
, optional) – Reference to the dataset object that has been used to train the model (default:None
) - experiment_version_description (str) – Description of the experiment version to create
Returns: Newly created ExternalExperimentVersion object
Return type: external_models.ExternalExperimentVersion
-
create_external_regression
()¶ Create a tabular regression experiment version from external models
Parameters: - experiment_name (str) – Name of the experiment to create
- holdout_dataset (
Dataset
) – Reference to the holdout dataset object to use for as holdout dataset - target_column (str) – The name of the target column for this experiment version
- external_models (list(tuple)) –
The external models to add in the experiment version to create. Each tuple contains 3 items describing an external model as follows:
- The name you want to give to the model
- The path to the model in onnx format
- The path to a yaml file containing metadata about the model
- metric (
metrics.Regression
, optional) – Specific metric to use for the experiment (default:metrics.Regression.RMSE
) - dataset (
Dataset
, optional) – Reference to the dataset object that has been used to train the model (default:None
) - experiment_version_description (str) – Description of the experiment version to create
Returns: Newly created ExternalExperimentVersion object
Return type: external_models.ExternalExperimentVersion
-
create_ftp_connector
(name: str, host: str, port: int, username: str, password: str)¶ A connector to interact with a distant source of data (and easily get data snapshots using an associated
DataSource
resource).Parameters: Returns: The registered connector object in the current project.
Return type:
-
create_gcp_connector
(name: str, googleCredentials: Dict)¶ A connector to interact with a distant source of data (and easily get data snapshots using an associated
DataSource
resource).Parameters: Returns: The registered connector object in the current project.
Return type:
-
create_image_folder
(name: str, file_name: str)¶ Register a new image dataset in the workspace for further processing (in the image folders group).
Note
To start a new experiment version on a dataset image, it has to be already registred in your workspace.
Parameters: Raises: PrevisionException
– Error while creating the dataset on the platformReturns: The registered dataset object in the current workspace.
Return type:
-
create_s3_connector
(name: str, username: str, password: str)¶ A connector to interact with a distant source of data (and easily get data snapshots using an associated
DataSource
resource).Parameters: Returns: The registered connector object in the current project.
Return type:
-
create_sftp_connector
(name: str, host: str, port: int, username: str, password: str)¶ A connector to interact with a distant source of data (and easily get data snapshots using an associated
DataSource
resource).Parameters: Returns: The registered connector object in the current project.
Return type:
-
create_sql_connector
(name: str, host: str, port: int, username: str, password: str)¶ A connector to interact with a distant source of data (and easily get data snapshots using an associated
DataSource
resource).Parameters: Returns: The registered connector object in the current project.
Return type:
-
delete
()¶ Delete a project from the actual [client] workspace.
Raises: PrevisionException
– If the project does not existrequests.exceptions.ConnectionError
– Error processing the request
-
fit_classification
(experiment_name: str, dataset: previsionio.dataset.Dataset, column_config: previsionio.experiment_config.ColumnConfig, metric: previsionio.metrics.Classification = <Classification.AUC: 'auc'>, holdout_dataset: previsionio.dataset.Dataset = None, training_config: previsionio.experiment_config.TrainingConfig = <previsionio.experiment_config.TrainingConfig object>, experiment_version_description: str = None) → previsionio.supervised.Supervised¶ Start a tabular classification experiment version training
Parameters: - experiment_name (str) – Name of the experiment to create
- dataset (
Dataset
) – Reference to the dataset object to use for as training dataset - column_config (
ColumnConfig
) – Column configuration for the experiment (see the documentation of theColumnConfig
resource for more details on each possible column types) - metric (
metrics.Classification
, optional) – Specific metric to use for the experiment (default:metrics.Classification.AUC
) - holdout_dataset (
Dataset
, optional) – Reference to a dataset object to use as a holdout dataset (default:None
) - training_config (
TrainingConfig
) – Specific training configuration (see the documentation of theTrainingConfig
resource for more details on all the parameters) - experiment_version_description (str) – Description of the experiment version to create
Returns: Newly created Supervised experiment version object
Return type:
-
fit_image_classification
(experiment_name: str, dataset: previsionio.dataset.Dataset, dataset_images: previsionio.dataset.DatasetImages, column_config: previsionio.experiment_config.ColumnConfig, metric: previsionio.metrics.Classification = <Classification.AUC: 'auc'>, holdout_dataset: previsionio.dataset.Dataset = None, training_config: previsionio.experiment_config.TrainingConfig = <previsionio.experiment_config.TrainingConfig object>, experiment_version_description: str = None) → previsionio.supervised.Supervised¶ Start an image classification experiment version training
Parameters: - experiment_name (str) – Name of the experiment to create
- dataset (
Dataset
) – Reference to the dataset object to use for as training dataset - dataset_images (
DatasetImages
) – Reference to the images dataset object to use for as training dataset - column_config (
ColumnConfig
) – Column configuration for the experiment (see the documentation of theColumnConfig
resource for more details on each possible column types) - metric (
metrics.Classification
, optional) – Specific metric to use for the experiment (default:metrics.Classification.AUC
) - holdout_dataset (
Dataset
, optional) – Reference to a dataset object to use as a holdout dataset (default:None
) - training_config (
TrainingConfig
) – Specific training configuration (see the documentation of theTrainingConfig
resource for more details on all the parameters) - experiment_version_description (str) – Description of the experiment version to create
Returns: Newly created Supervised experiment version object
Return type:
-
fit_image_multiclassification
(experiment_name: str, dataset: previsionio.dataset.Dataset, dataset_images: previsionio.dataset.DatasetImages, column_config: previsionio.experiment_config.ColumnConfig, metric: previsionio.metrics.MultiClassification = <MultiClassification.log_loss: 'log_loss'>, holdout_dataset: previsionio.dataset.Dataset = None, training_config: previsionio.experiment_config.TrainingConfig = <previsionio.experiment_config.TrainingConfig object>, experiment_version_description: str = None) → previsionio.supervised.Supervised¶ Start an image multiclassification experiment version training
Parameters: - experiment_name (str) – Name of the experiment to create
- dataset (
Dataset
) – Reference to the dataset object to use for as training dataset - dataset_images (
DatasetImages
) – Reference to the images dataset object to use for as training dataset - column_config (
ColumnConfig
) – Column configuration for the experiment (see the documentation of theColumnConfig
resource for more details on each possible column types) - metric (
metrics.MultiClassification
, optional) – Specific metric to use for the experiment (default:metrics.MultiClassification.log_loss
) - holdout_dataset (
Dataset
, optional) – Reference to a dataset object to use as a holdout dataset (default:None
) - training_config (
TrainingConfig
) – Specific training configuration (see the documentation of theTrainingConfig
resource for more details on all the parameters) - experiment_version_description (str) – Description of the experiment version to create
Returns: Newly created Supervised experiment version object
Return type:
-
fit_image_regression
(experiment_name: str, dataset: previsionio.dataset.Dataset, dataset_images: previsionio.dataset.DatasetImages, column_config: previsionio.experiment_config.ColumnConfig, metric: previsionio.metrics.Regression = <Regression.RMSE: 'rmse'>, holdout_dataset: previsionio.dataset.Dataset = None, training_config: previsionio.experiment_config.TrainingConfig = <previsionio.experiment_config.TrainingConfig object>, experiment_version_description: str = None) → previsionio.supervised.Supervised¶ Start an image regression experiment version training
Parameters: - experiment_name (str) – Name of the experiment to create
- dataset (
Dataset
) – Reference to the dataset object to use for as training dataset - dataset_images (
DatasetImages
) – Reference to the images dataset object to use for as training dataset - column_config (
ColumnConfig
) – Column configuration for the experiment (see the documentation of theColumnConfig
resource for more details on each possible column types) - metric (
metrics.Regression
, optional) – Specific metric to use for the experiment (default:metrics.Regression.RMSE
) - holdout_dataset (
Dataset
, optional) – Reference to a dataset object to use as a holdout dataset (default:None
) - training_config (
TrainingConfig
) – Specific training configuration (see the documentation of theTrainingConfig
resource for more details on all the parameters) - experiment_version_description (str) – Description of the experiment version to create
Returns: Newly created Supervised experiment version object
Return type:
-
fit_multiclassification
(experiment_name: str, dataset: previsionio.dataset.Dataset, column_config: previsionio.experiment_config.ColumnConfig, metric: previsionio.metrics.MultiClassification = <MultiClassification.log_loss: 'log_loss'>, holdout_dataset: previsionio.dataset.Dataset = None, training_config: previsionio.experiment_config.TrainingConfig = <previsionio.experiment_config.TrainingConfig object>, experiment_version_description: str = None) → previsionio.supervised.Supervised¶ Start a tabular multiclassification experiment version training
Parameters: - experiment_name (str) – Name of the experiment to create
- dataset (
Dataset
) – Reference to the dataset object to use for as training dataset - column_config (
ColumnConfig
) – Column configuration for the experiment (see the documentation of theColumnConfig
resource for more details on each possible column types) - metric (
metrics.MultiClassification
, optional) – Specific metric to use for the experiment (default:metrics.MultiClassification.log_loss
) - holdout_dataset (
Dataset
, optional) – Reference to a dataset object to use as a holdout dataset (default:None
) - training_config (
TrainingConfig
) – Specific training configuration (see the documentation of theTrainingConfig
resource for more details on all the parameters) - experiment_version_description (str) – Description of the experiment version to create
Returns: Newly created Supervised experiment version object
Return type:
-
fit_regression
(experiment_name: str, dataset: previsionio.dataset.Dataset, column_config: previsionio.experiment_config.ColumnConfig, metric: previsionio.metrics.Regression = <Regression.RMSE: 'rmse'>, holdout_dataset: previsionio.dataset.Dataset = None, training_config: previsionio.experiment_config.TrainingConfig = <previsionio.experiment_config.TrainingConfig object>, experiment_version_description: str = None) → previsionio.supervised.Supervised¶ Start a tabular regression experiment version training
Parameters: - experiment_name (str) – Name of the experiment to create
- dataset (
Dataset
) – Reference to the dataset object to use for as training dataset - column_config (
ColumnConfig
) – Column configuration for the experiment (see the documentation of theColumnConfig
resource for more details on each possible column types) - metric (
metrics.Regression
, optional) – Specific metric to use for the experiment (default:metrics.Regression.RMSE
) - holdout_dataset (
Dataset
, optional) – Reference to a dataset object to use as a holdout dataset (default:None
) - training_config (
TrainingConfig
) – Specific training configuration (see the documentation of theTrainingConfig
resource for more details on all the parameters) - experiment_version_description (str) – Description of the experiment version to create
Returns: Newly created Supervised experiment version object
Return type:
-
fit_text_similarity
(experiment_name: str, dataset: previsionio.dataset.Dataset, description_column_config: previsionio.text_similarity.DescriptionsColumnConfig, metric: previsionio.metrics.TextSimilarity = <TextSimilarity.accuracy_at_k: 'accuracy_at_k'>, top_k: int = 10, lang: previsionio.text_similarity.TextSimilarityLang = <TextSimilarityLang.Auto: 'auto'>, queries_dataset: previsionio.dataset.Dataset = None, queries_column_config: previsionio.text_similarity.QueriesColumnConfig = None, models_parameters: previsionio.text_similarity.ListModelsParameters = <previsionio.text_similarity.ListModelsParameters object>, experiment_version_description: str = None) → previsionio.text_similarity.TextSimilarity¶ Start a text similarity experiment version training with a specific training configuration.
Parameters: - experiment_name (str) – Name of the experiment to create
- dataset (
Dataset
) – Reference to the dataset object to use for as training dataset - description_column_config (
DescriptionsColumnConfig
) – Description column configuration (see the documentation of theDescriptionsColumnConfig
resource for more details on each possible column types) - metric (
metrics.TextSimilarity
, optional) – Specific metric to use for the experiment (default:metrics.TextSimilarity.accuracy_at_k
) - top_k (int, optional) – top_k (default:
10
) - lang (
TextSimilarityLang
, optional) – lang of the training dataset (default:TextSimilarityLang.Auto
) - queries_dataset (
Dataset
, optional) – Reference to a dataset object to use as a queries dataset (default:None
) - queries_column_config (
QueriesColumnConfig
) – Queries column configuration (see the documentation of theQueriesColumnConfig
resource for more details on each possible column types) - models_parameters (
ListModelsParameters
) – Specific training configuration (see the documentation of theListModelsParameters
resource for more details on all the parameters) - experiment_version_description (str) – Description of the experiment version to create
Returns: Newly created TextSimilarity experiment version object
Return type:
-
fit_timeseries_regression
(experiment_name: str, dataset: previsionio.dataset.Dataset, column_config: previsionio.experiment_config.ColumnConfig, time_window: previsionio.timeseries.TimeWindow, metric: previsionio.metrics.Regression = <Regression.RMSE: 'rmse'>, holdout_dataset: previsionio.dataset.Dataset = None, training_config: previsionio.experiment_config.TrainingConfig = <previsionio.experiment_config.TrainingConfig object>, experiment_version_description: str = None) → previsionio.timeseries.TimeSeries¶ Start a timeseries regression experiment version training
Parameters: - experiment_name (str) – Name of the experiment to create
- dataset (
Dataset
) – Reference to the dataset object to use for as training dataset - column_config (
ColumnConfig
) – Column configuration for the experiment version (see the documentation of theColumnConfig
resource for more details on each possible column types) - time_window (
TimeWindow
) – Time configuration (see the documentation of theTimeWindow
resource for more details) - metric (
metrics.Regression
, optional) – Specific metric to use for the experiment (default:metrics.Regression.RMSE
) - holdout_dataset (
Dataset
, optional) – Reference to a dataset object to use as a holdout dataset (default:None
) - training_config (
TrainingConfig
) – Specific training configuration (see the documentation of theTrainingConfig
resource for more details on all the parameters) - experiment_version_description (str) – Description of the experiment version to create
Returns: Newly created TimeSeries experiment version object
Return type:
-
classmethod
from_id
(_id: str)¶ Get a project from the instance by its unique id.
Parameters: _id (str) – Unique id of the resource to retrieve Returns: The fetched datasource Return type: Project
Raises: PrevisionException
– Any error while fetching data from the platform or parsing the result
-
info
() → Dict¶ Get a datasource from the instance by its unique id.
Parameters: _id (str) – Unique id of the resource to retrieve Returns: - Information about the Project with these entries:
- ”_id” “name” “description” “color” “created_by” “admins” “contributors” “viewers” “pipelines_count” “experiments_count” “dataset_count” “users”
Return type: Dict Raises: PrevisionException
– Any error while fetching data from the platform or parsing the result
-
classmethod
list
(all: bool = False)¶ List all the available project in the current active [client] workspace.
Parameters: 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 project objects Return type: list( Project
)
-
list_connectors
(all: bool = True)¶ List all the available connectors in the current active project.
Warning
Contrary to the parent
list()
function, this method returns actualConnector
objects rather than plain dictionaries with the corresponding data.Parameters: 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( Connector
)
-
list_datasets
(all: bool = True)¶ List all the available datasets in the current active project.
Warning
Contrary to the parent
list()
function, this method returns actualDataset
objects rather than plain dictionaries with the corresponding data.Parameters: 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( Dataset
)
-
list_datasource
(all: bool = False)¶ List all the available datasources in the current active project.
Warning
Contrary to the parent
list()
function, this method returns actualDataSource
objects rather than plain dictionaries with the corresponding data.Parameters: 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( DataSource
)
-
list_experiment_deployments
(all: bool = True)¶ List all the available experiment in the current project.
Parameters: 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 experiment deployment objects Return type: list( ExperimentDeployment
)
-
list_experiments
(all: bool = True)¶ List all the available experiment in the current project.
Parameters: 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 experiment objects Return type: list( Experiment
)
-
list_exporter
(all: bool = False)¶ List all the available exporters in the current active project.
Warning
Contrary to the parent
list()
function, this method returns actualExporter
objects rather than plain dictionaries with the corresponding data.Parameters: 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( Exporter
)
-
list_image_folders
(all: bool = True)¶ List all the available dataset image in the current active [client] workspace.
Warning
Contrary to the parent
list()
function, this method returns actualDatasetImages
objects rather than plain dictionaries with the corresponding data.Parameters: 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( DatasetImages
)
-
list_pipeline_scheduled_runs
(all: bool = False)¶ List all the available pipeline scheduled runs in the current active project.
Warning
Contrary to the parent
list()
function, this method returns actualExporter
objects rather than plain dictionaries with the corresponding data.Parameters: 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( PipelineScheduledRun
)
-
classmethod
new
(name: str, description: str = None, color: previsionio.project.ProjectColor = None) → previsionio.project.Project¶ Create a new project on the platform.
Parameters: Returns: The registered project object in the current workspace
Return type: Raises: PrevisionException
– Any error while uploading data to the platform or parsing the resultException
– For any other unknown error