mioXpektron.analysis.ml
Machine-learning benchmarking for aligned m/z feature matrices.
Functions
|
Benchmark a mapping of classifiers and return a sorted results table. |
|
Fit one classifier and return hold-out and CV metrics. |
|
SHAP beeswarm and bar plots when shap is installed. |
|
Return a compact set of classifiers suitable for m/z matrices. |
|
Return True when a classifier benefits from feature scaling. |
|
Plot absolute LR coefficients or RF feature importances. |
|
Bar chart of top model accuracies. |
|
Plot ROC curves for the top-performing probabilistic models. |
|
Prepare an aligned matrix for supervised classification benchmarks. |
|
Apply a variance-stabilising transform before embedding or ML. |
- mioXpektron.analysis.ml.model_needs_scaling(model)[source]
Return True when a classifier benefits from feature scaling.
- mioXpektron.analysis.ml.transform_features(X, *, method='log1p')[source]
Apply a variance-stabilising transform before embedding or ML.
- mioXpektron.analysis.ml.prepare_ml_data(data, *, label_col='Group', sample_col='SampleName', test_size=0.2, random_state=42, transform='log1p', scale_features=True, handle_missing='zero')[source]
Prepare an aligned matrix for supervised classification benchmarks.
- mioXpektron.analysis.ml.get_benchmark_models(*, random_state=42, include_boosting=True)[source]
Return a compact set of classifiers suitable for m/z matrices.
- mioXpektron.analysis.ml.evaluate_model(name, model, data_dict, *, cv_folds=5, max_train_time_for_cv=30.0)[source]
Fit one classifier and return hold-out and CV metrics.
- mioXpektron.analysis.ml.evaluate_all_models(models, data_dict, *, dataset_name='dataset')[source]
Benchmark a mapping of classifiers and return a sorted results table.
- mioXpektron.analysis.ml.plot_model_comparison(results_df, savepath, *, dataset_name='dataset', top_n=10)[source]
Bar chart of top model accuracies.
- mioXpektron.analysis.ml.plot_roc_curves(results_df, data_dict, models, savepath, *, top_n=2)[source]
Plot ROC curves for the top-performing probabilistic models.
- mioXpektron.analysis.ml.plot_feature_importance(model, feature_names, savepath, *, title, top_n=15)[source]
Plot absolute LR coefficients or RF feature importances.