museotoolbox.ai.SuperLearner.save_cm_from_cv¶
-
SuperLearner.
save_cm_from_cv
(savePath, prefix='', header=True, n_jobs=1)[source]¶ Save each confusion matrix (csv format) from cross-validation.
For each matrix, will save as header :
The number of training samples per class,
The F1-score per class,
Overall Accuracy,
Kappa.
Example of confusion matrix saved as csv :
# Training samples : 90,80
# F1 : 91.89,90.32
# OA : 91.18
# Kappa : 82.23
85
5
10
70
In X (columns) : prediction (95 predicted labels for class 1).
In Y (lines) : reference (90 labels from class 1).
- Parameters
savePath (str.) – The path where to save the different csv. If not exists, will be created
prefix (str, default ''.) – If prefix, will add this prefix before the csv name (i.e. 0.csv)
header (boolean, default True.) – If True, will save F1, OA, Kappa and number of training samples. If False, will only save confusion matrix
- Returns
- Return type
None
Examples
After having learned with
museotoolbox.ai.SuperLearner
:>>> SL.saveCMFromCV('/tmp/testMTB/',prefix='RS50_') [Parallel(n_jobs=-1)]: Using backend LokyBackend with 4 concurrent workers. [Parallel(n_jobs=-1)]: Done 10 out of 10 | eSLsed: 3.4s finished >>> np.loadtxt('/tmp/testMTB/RS50_0.csv') array([[85, 5], [10, 70]])