class previsionio.usecase.Usecase(_id: str, project_id: str, provider: str, name: str, training_type: previsionio.usecase_config.TypeProblem, data_type: previsionio.usecase_config.DataType)

Bases: previsionio.api_resource.ApiResource

A Usecase

  • _id (str) – Unique id of the usecase
  • name (str) – Name of the usecase

Delete a usecase from the actual [client] workspace.

  • PrevisionException – If the usecase does not exist
  • requests.exceptions.ConnectionError – Error processing the request
classmethod from_id(_id: str) → previsionio.usecase.Usecase

Get a usecase from the platform by its unique id.

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

Get the latest version of this use case.

Returns:latest UsecaseVersion in this Usecase
Return type:(previsionio.text_similarity.TextSimilarity | Supervised | TimeSeries)
classmethod list(project_id: str, all: bool = True) → List[previsionio.usecase.Usecase]

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


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

  • 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.

Fetched dataset objects

Return type:



Get the type of UsecaseVersion class used by this Usecase

Returns:Type of UsecaseVersion
Return type:(previsionio.text_similarity.TextSimilarity | Supervised | TimeSeries)

Get the list of all versions for the current use case.

Returns:List of the usecase versions (as JSON metadata)
Return type:list(previsionio.text_similarity.TextSimilarity | Supervised | TimeSeries)
previsionio.usecase.get_usecase_version_class(training_type: previsionio.usecase_config.TypeProblem, data_type: previsionio.usecase_config.DataType, provider: str) → Union[Type[previsionio.text_similarity.TextSimilarity], Type[previsionio.supervised.Supervised], Type[previsionio.timeseries.TimeSeries], Type[previsionio.external_models.ExternalUsecaseVersion]]

Get the type of UsecaseVersion class used by this Usecase

Returns:Type of UsecaseVersion
Return type:(:type:`.TextSimilarity` | :type:`.Supervised` | :type:`.TimeSeries` | :type:`.ExternalUsecaseVersion`)