Machine learning

Rampy offers three classes for performing classification, regression or unsupervised ML exploration of a set of spectra. Those are helpful ways to automatically perform usual scalling, test-train splitting and ML training of popular ML algorithms, and use scikit-learn in the background.

Those functions work (rp.regressor was used in this publication) but still may evolve in the futur. For advanced, ML, I suggest using directly scikit-learn or other ML libraries.

Do not hesitate to ask for new features depending on your needs !

In the following, we assume you already performed library importation as

# importing rampy
import rampy as rp
# and for numpy we will respect the usual name:
import numpy as np
# for matplotlib
import matplotlib.pyplot as plt

ML Exploration

The rampy.mlexplorer class allows performing PCA and NMF at the moment (work in progress). See the example notebook.

ML regression

The rampy.regressor class allows linking variations in spectra to some known variations like the composition of a sample. See the example notebook.

ML classification

The rampy.classificator class allows automatic recognition of substances/stuffs from spectra. See the example notebook here.

Linear mixture

If you have two endmember spectra, you can use the rampy.mixing() function. See the mixing example notebook here.

If you do not know the endmember spectra, then you may be interested in using directly the PyMCR library, see the documentation here and an example notebook here. We used it in this publication, see the code here.