A modular Python framework for standardised evaluation and benchmarking of online learning models
Project description
float (FrictionLess Online model Analysis and Testing) is a modular Python-framework for standardized evaluations of online learning methods. float can combine custom code with popular libraries and provides easy access to sensible evaluation strategies, measures and visualisations.
Release Notes:
02/02/22 - v0.0.1, Initial release.
22/09/22 - v0.0.2, Minor updates and corrections + Dynamic Model Tree classifier.
Installation
Install float with pip:
pip install float-evaluation
Alternatively, execute the following code in a command line to clone the float repository from Github:
git clone git@github.com:haugjo/float.git
Requirements
Float is supported by python versions >=3.8.x and has the following package requirements:
- numpy >= 1.22.1
- scikit-learn >= 1.0.2
- tabulate >= 0.8.5
- matplotlib >= 3.4.2
- scipy >= 1.7.3
- pandas >= 1.4.0
- river >= 0.9.0
- scikit-multiflow >= 0.5.3
[!] Older versions have not been tested, but might also be compatible.
Quickstart
The easiest way to become familiar with float and its functionality is to look at the example notebooks in the documentation or ./docs/examples
respectively.
We provide experiments that showcase each of the three evaluation pipelines prequential, holdout and
distributed fold. We also demonstrate the use of the change detection, online feature selection and
visualization modules.
As a quickstart, you can run the following basic experiment:
from skmultiflow.trees import HoeffdingTreeClassifier
from sklearn.metrics import zero_one_loss
from float.data import DataLoader
from float.prediction.evaluation import PredictionEvaluator
from float.prediction.evaluation.measures import noise_variability
from float.pipeline import PrequentialPipeline
from float.prediction.skmultiflow import SkmultiflowClassifier
# Load a data set from main memory with the DataLoader module.
# Alternatively, we can provide a sciki-multiflow FileStream object via the 'stream' attribute.
data_loader = DataLoader(path='./datasets/spambase.csv', target_col=-1)
# Set up an online classifier. Note that we need a wrapper to use scikit-multiflow functionality.
classifier = SkmultiflowClassifier(model=HoeffdingTreeClassifier(),
classes=data_loader.stream.target_values)
# Set up an evaluator object for the classifier:
# Specifically, we want to measure the zero_one_loss and the noise_variability as an indication of robustness.
# The arguments of the measure functions can be directly added to the Evaluator object constructor,
# e.g. we may specify the number of samples (n_samples) and the reference_measure used to compute the noise_variability.
evaluator = PredictionEvaluator(measure_funcs=[zero_one_loss, noise_variability],
n_samples=15,
reference_measure=zero_one_loss)
# Set up a pipeline for a prequential evaluation of the classifier.
pipeline = PrequentialPipeline(data_loader=data_loader,
predictor=classifier,
prediction_evaluator=evaluator,
n_max=data_loader.stream.n_samples,
batch_size=25)
# Run the experiment.
pipeline.run()
Output:
[====================] 100%
################################## SUMMARY ##################################
Evaluation has finished after 9.49581503868103s
Data Set: ./float/data/datasets/spambase.csv
The PrequentialPipeline has processed 4601 instances, using batches of size 25.
-------------------------------------------------------------------------
*** Prediction ***
Model: SkmultiflowClassifier.HoeffdingTreeClassifier
| Performance Measure | Value |
|------------------------|-----------|
| Avg. Test Comp. Time | 0.0032578 |
| Avg. Train Comp. Time | 0.0053197 |
| Avg. zero_one_loss | 0.180552 |
| Avg. noise_variability | 0.241901 |
#############################################################################
Package Structure
Float is fully modular. The package has dedicated modules for the data preparation, online prediction, online
feature selection, concept drift detection and their evaluation (corresponding to the directories in ./float
).
The pipeline module is at the heart of every experiment in float. The pipeline can be run with arbitrary combinations of predictors, online feature selectors and concept drift detectors.
The results of every experiment are stored in dedicated evaluator objects. Via these evaluators, the user is able to specify the performance measures that will be computed during the evaluation. After running the pipeline, the evaluators can be used to create custom tables and plots or to obtain standardized visualizations with the float visualization module.
Each of the above-mentioned modules contains an abstract base class that simplifies the integration of custom functionality in the experiment.
Float also provides wrappers for scikit-mukltiflow and river functionality wherever available. Besides float integrates the change detectors implemented by the Tornado package.
Datasets
Float is accompanied by a small set of popular streaming data sets that are required to run the
experiment notebooks and unit tests. These fully cleansed and normalized data sets can be found in ./datasets
.
Although there is a general shortage of publicly available streaming data sets, there are some useful resources:
- https://www.openml.org/search?type=data (search for "data stream" or "concept drift")
- https://sites.google.com/view/uspdsrepository
- https://github.com/ogozuacik/concept-drift-datasets-scikit-multiflow
- https://github.com/vlosing/driftDatasets
References
Please refer to the following paper when using float: Haug, Johannes, Effi Tramountani, and Gjergji Kasneci. "Standardized Evaluation of Machine Learning Methods for Evolving Data Streams." arXiv preprint arXiv:2204.13625 (2022).
Please also make sure that you acknowledge the corresponding authors, when using one of the provided models (Relevant sources and papers are linked in the docstrings of each file).
Contribution
We welcome meaningful contributions by the community. In particular, we encourage contributions of new evaluation strategies, performance measures, expressive visualizations and streaming data sets.
Additionally, we welcome implementations of novel online learning models. However, we discourage contributing models that are already included in one of the major libraries, e.g. scikit-multiflow or river (i.e., float is primarily an evaluation toolkit and not a library of state-of-the-art online learning methods).
All contributed source code must adhere to the following criteria:
- Code must conform with the PEP8 standard.
- Docstrings must conform with the Google docstring convention.
- All unit tests in
./tests
must run successfully. To run the complete test suite, one may execute./tests/run_test_suite.py
.
Please feel free to contact us, if you plan to make a contribution.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file float-evaluation-0.0.2.tar.gz
.
File metadata
- Download URL: float-evaluation-0.0.2.tar.gz
- Upload date:
- Size: 71.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d10a5272bea20a0b9f4b5e52acf68d01f4186c4fb79c4f8cd28529426be21bb0 |
|
MD5 | 2665f4a6d38f836393b0f01fc62f45e7 |
|
BLAKE2b-256 | 1c40974a72183cc3f8c0b16b0bbf4634a8ff0a661bc57aa9e0fa738448870358 |
File details
Details for the file float_evaluation-0.0.2-py3-none-any.whl
.
File metadata
- Download URL: float_evaluation-0.0.2-py3-none-any.whl
- Upload date:
- Size: 122.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5d311b655465a3090684bca4c6c9e5ddd7f080d76326a524026f880637a5b603 |
|
MD5 | eec20f2345636b8dd212ccb12e5c4ada |
|
BLAKE2b-256 | 995ba4789fe388bc509a30dbb02f441e1595a6897511a86e567375c012cb37e8 |