Project#

class skore.Project(name, *, mode='local', **kwargs)[source]#

API to manage a collection of key-report pairs.

Its constructor initializes a project by creating a new project or by loading an existing one.

The class main methods are put(), summarize() and get(), respectively to insert a key-report pair into the project, to obtain the metadata/metrics of the inserted reports and to get a specific report by its id.

Three mutually exclusive modes are available and can be configured using the mode parameter of the constructor:

Hub mode

The project is configured to communicate with skore hub.

In this mode, name is expected to be of the form <workspace>/<name>, where the workspace is a skore hub concept that must be configured on the skore hub interface. It represents an isolated entity managing users, projects, and resources. It can be a company, organization, or team that operates independently within the system.

Note: Using Project in hub mode requires an account on skore hub, with access rights to the specified workspace. Authentication to skore hub is done by running skore.login() before instantiating the Project.

Local mode

Otherwise, the project is configured to the local mode to be persisted on the user machine in a directory called workspace.

The workspace can be shared between all the projects.
The workspace can be set using kwargs or the environment variable SKORE_WORKSPACE.
If not, it will be by default set to a skore/ directory in the user cache directory:
  • on Windows, usually C:\Users\%USER%\AppData\Local\skore,

  • on Linux, usually ${HOME}/.local/share/skore,

  • on macOS, usually ${HOME}/Library/Application Support/skore.

MLflow mode

In this mode, name is used as the MLflow experiment name. Reports are persisted as MLflow model artifacts in runs created under this experiment.

Refer to the Storing data science artifacts section of the user guide for more details.

Parameters:
namestr

The name of the project.

mode{“hub”, “local”, “mlflow”}

The mode of the project.

**kwargsdict

Extra keyword arguments passed to the project, depending on its mode.

workspacePath, mode:local only.

The directory where the local project is persisted.

Attributes:
namestr

The name of the project.

mode{“hub”, “local”, “mlflow”}

The mode of the project.

ml_taskMLTask

The ML task of the project; unset until a first report is put.

See also

Project.summarize()

Create a summary view to investigate persisted reports’ metadata/metrics.

Examples

Construct reports.

>>> from sklearn.datasets import make_classification, make_regression
>>> from sklearn.linear_model import LinearRegression, LogisticRegression
>>> from sklearn.model_selection import train_test_split
>>> from skore import CrossValidationReport, EstimatorReport
>>>
>>> X, y = make_classification(random_state=42)
>>> X_train, X_test, y_train, y_test = train_test_split(X, y, random_state=42)
>>> classifier = LogisticRegression(max_iter=10)
>>> classifier_report = EstimatorReport(
>>>     classifier,
>>>     X_train=X_train,
>>>     y_train=y_train,
>>>     X_test=X_test,
>>>     y_test=y_test,
>>> )
>>>
>>> X, y = make_regression(random_state=42)
>>> X_train, X_test, y_train, y_test = train_test_split(X, y, random_state=42)
>>> regressor = LinearRegression()
>>> regressor_report = EstimatorReport(
>>>     regressor,
>>>     X_train=X_train,
>>>     y_train=y_train,
>>>     X_test=X_test,
>>>     y_test=y_test,
>>> )
>>>
>>> cv_regressor_report = CrossValidationReport(regressor, X, y)

Construct the project in local mode, persisted in a temporary directory.

>>> from pathlib import Path
>>> from tempfile import TemporaryDirectory
>>> from skore import Project
>>>
>>> tmpdir = TemporaryDirectory().name
>>> local_project = Project(mode="local", name="my-xp", workspace=Path(tmpdir))

Put reports in the project.

>>> local_project.put("my-simple-regression", regressor_report)
>>> local_project.put("my-simple-cv_regression", cv_regressor_report)

Investigate metadata/metrics to filter the best reports.

>>> summary = local_project.summarize()
>>> summary = summary.query("rmse < 67")
>>> reports = summary.reports()
static delete(name, *, mode='local', **kwargs)[source]#

Delete a project. Not implemented for MLFlow projects.

Parameters:
namestr

The name of the project.

mode{“hub”, “local”, “mlflow”}, default “local”

The mode of the project.

**kwargsdict

Extra keyword arguments passed to the project, depending on its mode.

workspacePath, mode:local only.

The directory where the local project is persisted.

The workspace can be shared between all the projects.
The workspace can be set using kwargs or the environment variable SKORE_WORKSPACE.
If not, it will be by default set to a skore/ directory in the USER cache directory:
  • on Windows, usually C:\Users\%USER%\AppData\Local\skore,

  • on Linux, usually ${HOME}/.cache/skore,

  • on macOS, usually ${HOME}/Library/Caches/skore.

tracking_uristr, mode:mlflow only.

The URI of the MLflow tracking server.

get(id)[source]#

Get a persisted report by its id.

Report IDs can be found via skore.Project.summarize(), which is also the preferred method of interacting with a skore.Project.

Parameters:
idstr

The id of a report already put in the project.

Raises:
KeyError

If a non-existent ID is passed.

property mode#

The mode of the project.

property name#

The name of the project.

put(key, report)[source]#

Put a key-report pair to the project.

If the key already exists, its last report is modified to point to this new report, while keeping track of the report history.

Parameters:
keystr

The key to associate with report in the project. Name of the run for mode:mlflow

reportEstimatorReport | CrossValidationReport

The report to associate with key in the project.

Raises:
TypeError

If the combination of parameters are not valid.

summarize()[source]#

Obtain metadata/metrics for all persisted reports.