A machine learning interface for isolated sequence classification algorithms in Python.
Project description
A machine learning interface for isolated sequence classification algorithms in Python.
Introduction
Sequential data is a commonly-observed, yet difficult-to-handle form of data. These can range from time series (sequences of observations occurring through time) to non-temporal sequences such as DNA nucleotides.
Time series data such as audio signals, stock prices and electro-cardiogram signals are often of particular interest to machine learning practitioners and researchers, as changing patterns over time naturally provide many interesting opportunities and challenges for machine learning prediction and statistical inference.
Sequentia is a Python package that specifically aims to tackle classification problems for isolated sequences by providing implementations of a number of classification algorithms.
Examples of such classification problems include:
- classifying a spoken word based on its audio signal (or some other representation such as MFCCs),
- classifying a hand-written character according to its pen-tip trajectory,
- classifying a hand or head gesture in a motion-capture recording,
- classifying the sentiment of a phrase or sentence in natural language.
Compared to the classification of fixed-size inputs (e.g. a vector, or images), sequence classification problems face two major hurdles:
- the sequences are generally of different duration to each other,
- the observations within a given sequence (may) have temporal dependencies on previous observations which occured earlier within the same sequence, and these dependencies may be arbitrarily long.
Sequentia aims to provide interpretable out-of-the-box machine learning algorithms suitable for these tasks, which require minimal configuration.
In recent times, variants of the Recurrent Neural Network (particularly LSTMs and GRUs) have generally proven to be the most successful in modelling long-term dependencies in sequences. However, the design of RNN architectures is very opiniated and requires much configuration and engineering, and is therefore not included as part of the package.
Features
The following algorithms provided within Sequentia support the use of multivariate observation sequences with different durations.
Classification algorithms
- Hidden Markov Models (via
hmmlearn
)
Learning with the Baum-Welch algorithm [1]- Gaussian Mixture Model emissions
- Linear, left-right and ergodic topologies
- Dynamic Time Warping k-Nearest Neighbors (via
dtaidistance
)- Sakoe–Chiba band global warping constraint
- Feature-independent warping (DTWI)
- Custom distance-weighted predictions
- Multi-processed predictions
Example of a classification algorithm: a multi-class HMM sequence classifier
Preprocessing methods
- Centering, standardization and min-max scaling
- Decimation and mean downsampling
- Mean and median filtering
Installation
pip install sequentia
Documentation
Documentation for the package is available on Read The Docs.
Tutorials and examples
For tutorials and examples on the usage of Sequentia, look at the notebooks here.
Acknowledgments
In earlier versions of the package (<0.10.0), an approximate dynamic time warping algorithm implementation (fastdtw
) was used in hopes of speeding up k-NN predictions, as the authors of the original FastDTW paper [2] claim that approximated DTW alignments can be computed in linear memory and time - compared to the O(N^2) runtime complexity of the usual exact DTW implementation.
However, I was recently contacted by Prof. Eamonn Keogh (at University of California, Riverside), whose recent work [3] makes the surprising revelation that FastDTW is generally slower than the exact DTW algorithm that it approximates. Upon switching from the fastdtw
package to dtaidistance
(a very solid implementation of exact DTW with fast pure C compiled functions), DTW k-NN prediction times were indeed reduced drastically.
I would like to thank Prof. Eamonn Keogh for directly reaching out to me regarding this finding!
References
Contributors
All contributions to this repository are greatly appreciated. Contribution guidelines can be found here.
Edwin Onuonga ✉️ 🌍 |
---|
Sequentia © 2019-2022, Edwin Onuonga - Released under the MIT License.
Authored and maintained by Edwin Onuonga.
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
File details
Details for the file sequentia-0.10.1.tar.gz
.
File metadata
- Download URL: sequentia-0.10.1.tar.gz
- Upload date:
- Size: 39.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/51.0.0.post20201207 requests-toolbelt/0.9.1 tqdm/4.55.0 CPython/3.7.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e738e16f08e6ab4903ef125b73015db562079be0926ba45191480dcc6b25b091 |
|
MD5 | d83e1f3f5561b27361f41aaecc666731 |
|
BLAKE2b-256 | 537c13723e824ea3d249b9c4f307cb106e3471c4180ad72c7667ce069cbca87c |