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.3.3.tar.gz (7.9 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.3.3-py3-none-any.whl (7.5 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for sevml-0.3.3.tar.gz
Algorithm Hash digest
SHA256 f83654dda8977a96c95b3525347c8c960ef199041725f5f970a0658f6148807f
MD5 6adabfd4e1a8189e54af6babdffe84fd
BLAKE2b-256 ad26b40091858002714b9af65eb580233167fd341b331ddd8633e2161e353ed5

See more details on using hashes here.

File details

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

File metadata

  • Download URL: sevml-0.3.3-py3-none-any.whl
  • Upload date:
  • Size: 7.5 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.3.3-py3-none-any.whl
Algorithm Hash digest
SHA256 72ee83fb890b0ac4e3cc4ca9f4bb2094ea919572fe1cd2455033787c90e32a0c
MD5 7ed0f9a3ed5ad954198a84c5fdc2fb62
BLAKE2b-256 07c9787cb1061809e512ae250fd86dca721c0d4ee8bd6517c581ff21e24a8a82

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