Skip to main content

Machine learning tools for biological analysis

Project description

sevml: Small Extracellular Vesicles Machine Learning Toolkit

A Python toolkit developed by the INSERM U1231 HSPpathies team for the biological analysis.

Overview

sevml is designed to facilitate the preprocessing, modeling, evaluation, and interpretation of machine learning pipelines based on biological data.

Key features:

  • Preprocess ELISA datasets (pivot, clean, normalize)
  • Train XGBoost models with hyperparameter tuning
  • Visualize learning and validation curves
  • Evaluate model performance with ROC curves and confusion matrices
  • Interpret feature importance using SHAP values

Disclosure : the Preprocess ELISA datasets function is highly specific to our laboratory and will need modifiction to be integrated in other relationnals databases outputs.

The package is built following this structure:

sevml/
├── __init__.py          # Package initializer
├── main.py              # Only the CLI or entrypoint
├── preprocessing.py     # Functions like preprocess_elisa_dataset
├── training.py          # train_xgb_with_gridsearch, etc.
├── evaluation.py        # evaluate_model
├── visualization.py     # plot_model_curves, plot_shap_explanations
└── utils.py             # Any shared utilities



## Installation

To install required dependencies:

```bash
pip install -r requirements.txt

Dependencies include:

  • numpy
  • pandas
  • matplotlib
  • scikit-learn
  • xgboost
  • shap

Usage

from sevml import (
    preprocess_elisa_dataset,
    train_xgb_with_gridsearch,
    evaluate_model,
    plot_model_curves,
    plot_shap_explanations
)

# Load and preprocess dataset
label_mapping = {"A": 0, "B": 1}
X_train, X_test, y_train, y_test = preprocess_elisa_dataset("path/to/data.csv", label_mapping)

# Train model
model, params = train_xgb_with_gridsearch(X_train, y_train)

# Evaluate model
evaluate_model(model, X_train, y_train, X_test, y_test)

# Visualize curves
plot_model_curves(model, X_train, y_train)

# SHAP explanations
plot_shap_explanations(X_test, model, df_features)

API Reference

preprocess_elisa_dataset(filepath, label_mapping, test_size=0.2, random_state=5)

  • Loads a raw ELISA CSV dataset.
  • Pivots biomarker data to wide format.
  • Imputes missing values (median).
  • Scales features using MinMax.
  • Splits data into training and testing sets.

train_xgb_with_gridsearch(X, y, eval_metric='logloss', random_state=5, cv=3)

  • Trains an XGBoost classifier.
  • Performs grid search over hyperparameters.
  • Returns best model and parameters.

evaluate_model(model, X_train, y_train, X_test, y_test)

  • Plots ROC curves and confusion matrices.
  • Computes AUC, accuracy, and F1 scores.

plot_model_curves(...)

  • Plots learning and validation curves.
  • Helpful for diagnosing under/overfitting.

plot_shap_explanations(X, model, df_features)

  • Uses SHAP to explain model predictions.
  • Generates multiple plots: heatmap, violin, beeswarm, bar, waterfall.

Context

This package is developed and maintained by the HSPpathies team within the INSERM U1231 research unit. It is used in clinical and translational studies.

License

MIT License Copyright 2025

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Authors

  • Dr Isen Naiken
  • HSP-pathies Team, INSERM U1231, Dijon, France

Contact

For questions or collaborations: isen_naiken@etu.u-bourgogne.fr

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sevml-0.4.0.tar.gz (5.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sevml-0.4.0-py3-none-any.whl (8.3 kB view details)

Uploaded Python 3

File details

Details for the file sevml-0.4.0.tar.gz.

File metadata

  • Download URL: sevml-0.4.0.tar.gz
  • Upload date:
  • Size: 5.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.2

File hashes

Hashes for sevml-0.4.0.tar.gz
Algorithm Hash digest
SHA256 ee23e93b2c12b96c32186702b704a3c76f0c23b0ad61a3f018b9e30bd2d88f2f
MD5 4faa41b219d7f9882cb70a71687e1231
BLAKE2b-256 64e00a305425f298de0901f766f4696a4cfd75591404c6a17a4a732ca6625009

See more details on using hashes here.

File details

Details for the file sevml-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: sevml-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 8.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.2

File hashes

Hashes for sevml-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7251f1cbb1d64ee0f198af2f127566b9aa265f66f78a00e3d1088326a9233563
MD5 fa2ec80775522f76aae8999dd833ff93
BLAKE2b-256 da1026532c00a9eb72db0023b5dd3a6a213f0d736141203e2d7b3153929717f5

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page