leaspy.datasets#

Submodules#

Classes#

DatasetName

Enum for the names of the datasets available in Leaspy.

Functions#

get_dataset_path(name)

Get the path to the dataset file.

get_individual_parameter_path(name)

Get the path to the individual parameters file.

get_model_path(name)

Get the path to the model parameters file.

load_dataset(dataset_name)

Load synthetic longitudinal observations mimicking cohort of subjects with neurodegenerative disorders.

load_individual_parameters(name)

Load a Leaspy instance with a model already calibrated on the synthetic dataset corresponding to the name

load_model(name)

Load a model already calibrated on the synthetic dataset corresponding to the name of the instance.

Package Contents#

class DatasetName#

Bases: str, enum.Enum

Enum for the names of the datasets available in Leaspy. The names correspond to the files in the data folder.

ALZHEIMER = 'alzheimer'#
PARKINSON = 'parkinson'#
PARKINSON_PUTAMEN = 'parkinson-putamen'#
PARKINSON_PUTAMEN_TRAIN_TEST = 'parkinson-putamen-train_and_test'#
get_dataset_path(name)#

Get the path to the dataset file.

Parameters:
namestr or DatasetName

The name of the dataset.

Returns:
pathlib.Path

The path to the dataset file.

Parameters:

name (Union[str, DatasetName])

Return type:

Path

Examples

>>> from leaspy.datasets.loader import get_dataset_path
>>> path = get_dataset_path("alzheimer")
get_individual_parameter_path(name)#

Get the path to the individual parameters file.

Parameters:
namestr or DatasetName

The name of the dataset.

Returns:
pathlib.Path

The path to the individual parameters file.

Raises:
ValueError

If the dataset does not have individual parameters, such as parkinson-putamen-train_and_test.

Parameters:

name (Union[str, DatasetName])

Return type:

Path

get_model_path(name)#

Get the path to the model parameters file.

Parameters:
namestr or DatasetName

The name of the dataset.

Returns:
pathlib.Path

The path to the model parameters file.

Raises:
ValueError

If the dataset does not have a model, such as parkinson-putamen-train_and_test.

Parameters:

name (Union[str, DatasetName])

Return type:

Path

load_dataset(dataset_name)#

Load synthetic longitudinal observations mimicking cohort of subjects with neurodegenerative disorders.

Parameters:
dataset_namestr or DatasetName

The name of the dataset to load.

Returns:
pandas.DataFrame

The DataFrame containing the IDs, timepoints and observations.

Parameters:

dataset_name (Union[str, DatasetName])

Return type:

DataFrame

Notes

All DataFrames have the same structures.

  • Index: a pandas.MultiIndex - ['ID', 'TIME'] which contain IDs and timepoints.

    The DataFrame is sorted by index. So, one line corresponds to one visit for one subject. The DataFrame having ‘train_and_test’ in their name also have 'SPLIT' as the third index level. It differentiate train and test data.

  • Columns: One column correspond to one feature (or score).

load_individual_parameters(name)#

Load a Leaspy instance with a model already calibrated on the synthetic dataset corresponding to the name of the instance.

Parameters:
namestr or DatasetName

The name of the individual parameters to load.

Returns:
IndividualParameters

Leaspy instance with a model already calibrated.

Parameters:

name (Union[str, DatasetName])

Return type:

IndividualParameters

load_model(name)#

Load a model already calibrated on the synthetic dataset corresponding to the name of the instance.

Parameters:
namestr or DatasetName

The name of the instance to load.

Returns:
BaseModel

Model instance already calibrated.

Parameters:

name (Union[str, DatasetName])

Return type:

BaseModel