sleepless.engine.analyze#

Analyze script.

Functions

metric_stats(dataset[, bins])

Compute different metrics on a dataset and saved them as table and figure.

metrics_computation(data, name)

Compute metrics for the scikit-learn pipeline,6 metrics are computed: accuracy, confusion matrix, matthews_corrcoef, balanced_accuracy, linear weighted Kappa and quadratic weighted Kappa.

misclassified_analyze(dataset)

Compute an analysis of the misclassified and well classified Epochs of a dataset, for each samples of the dataset, one figure (prediction/true label) and a table is generated.

sleepless.engine.analyze.metric_stats(dataset, bins=[0, 18, 60, 70, 80, 90, 100, 110])[source]#

Compute different metrics on a dataset and saved them as table and figure.

Parameters:
  • dataset (dict[str, list[DelayedSample]]) – A dictionary containing different sets (e.g. train,test).

  • bins (list[int]) – definition of the age categories

  • out_path – the path location where fils will be saved

Return type:

tuple[list, list, Iterable[tuple]]

Returns:

list of figures, list of tables and dictionary of metrics

sleepless.engine.analyze.metrics_computation(data, name)[source]#

Compute metrics for the scikit-learn pipeline,6 metrics are computed: accuracy, confusion matrix, matthews_corrcoef, balanced_accuracy, linear weighted Kappa and quadratic weighted Kappa.

Parameters:
  • data (DataFrame) – a dataframe containing label and prediction for different samples

  • name (str) – path location where files will be saved

Return type:

tuple[DataFrame, list[Figure]]

Returns:

Matthews_corrcoef, accuracy, linear weighted Kappa, quadratic weighted Kappa and balanced_accuracy are return in common pd.Dataframe(df_metrics) Figure of confusion matrix are return as list of figure

sleepless.engine.analyze.misclassified_analyze(dataset)[source]#

Compute an analysis of the misclassified and well classified Epochs of a dataset, for each samples of the dataset, one figure (prediction/true label) and a table is generated.

Parameters:

dataset (dict[str, list[DelayedSample]]) – a sample of a data

Return type:

tuple[list, dict[str, dict]]

Returns:

list of figures and a dictionary