Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[release] 0.7.0 🎉 #92

Merged
merged 20 commits into from
May 19, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -85,4 +85,5 @@ venv.bak/

# Spyder project settings
.spyderproject
.spyproject
.spyproject
.vscode
38 changes: 29 additions & 9 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,33 +1,57 @@
## [0.6.1](https://github.com/eonu/sequentia/releases/tag/v0.6.1)
## [0.7.0](https://github.com/eonu/sequentia/releases/tag/v0.7.0)

#### Major changes

- Remove strict requirement of Numpy arrays being two-dimensional by using `numpy.atleast_2d` to convert one-dimensional arrays into 2D. ([#70](https://github.com/eonu/sequentia/pull/70))
- Fix `pomegranate` version to v0.12.0. ([#79](https://github.com/eonu/sequentia/pull/79))
- Add serialization and deserialization support for all classifiers. ([#80](https://github.com/eonu/sequentia/pull/80))
- `HMM`, `HMMClassifier`: Serialized in JSON format.
- `KNNClassifier`: Serialized in [HDF5](https://support.hdfgroup.org/HDF5/doc/H5.intro.html) format.
- Finish preprocessing documentation and tests. ([#81](https://github.com/eonu/sequentia/pull/81))
- (_Internal_) Remove nested helper functions in `KNNClassifier.predict()`. ([#84](https://github.com/eonu/sequentia/pull/84))
- Add strict left-right HMM topology. ([#85](https://github.com/eonu/sequentia/pull/85))<br/>**Note**: This is the more traditional left-right HMM topology.
- Implement GMM-HMMs in the `GMMHMM` class. ([#87](https://github.com/eonu/sequentia/pull/87))
- Implement custom, uniform and frequency-based HMM priors. ([#88](https://github.com/eonu/sequentia/pull/88))
- Implement distance-weighted DTW-kNN predictions. ([#90](https://github.com/eonu/sequentia/pull/90))
- Rename `DTWKNN` to `KNNClassifer`. ([#91](https://github.com/eonu/sequentia/pull/91))

#### Minor changes
- (_Internal_) Simplify package imports. ([#82](https://github.com/eonu/sequentia/pull/82))
- (_Internal_) Add `Validator.func()` for validating callables. ([#90](https://github.com/eonu/sequentia/pull/90))

## [v0.7.0a1](https://github.com/eonu/sequentia/releases/tag/v0.7.0a1)

#### Major changes
- Clean up package imports. ([#77](https://github.com/eonu/sequentia/pull/77))
- Rework `preprocessing` module. ([#75](https://github.com/eonu/sequentia/pull/75))

#### Minor changes
- Fix typos and update preprocessing information in `README.md`. ([#76](https://github.com/eonu/sequentia/pull/76))

## [0.6.1](https://github.com/eonu/sequentia/releases/tag/v0.6.1)

#### Major changes
- Remove strict requirement of Numpy arrays being two-dimensional by using `numpy.atleast_2d` to convert one-dimensional arrays into 2D. ([#70](https://github.com/eonu/sequentia/pull/70))

#### Minor changes
- As the HMM classifier is not a true ensemble of HMMs (since each HMM doesn't really contribute to the classification), it is no longer referred to as an ensemble. ([#69](https://github.com/eonu/sequentia/pull/69))

## [0.6.0](https://github.com/eonu/sequentia/releases/tag/v0.6.0)

#### Major changes

- Add package tests and Travis CI support. ([#56](https://github.com/eonu/sequentia/pull/56))
- Remove Python v3.8+ support. ([#56](https://github.com/eonu/sequentia/pull/56))
- Rename `normalize` preprocessing method to `center`, since it just centers an observation sequence. ([#62](https://github.com/eonu/sequentia/pull/62))
- Add `standardize` preprocessing method for standardizing (standard scaling) an observation sequence. ([#63](https://github.com/eonu/sequentia/pull/63))
- Add `trim_zeros` preprocessing method for removing zero-observations from an observation sequence. ([#67](https://github.com/eonu/sequentia/pull/67))

#### Minor changes

- (_Internal_) Add `Validator.random_state` for validating random state objects and seeds. ([#56](https://github.com/eonu/sequentia/pull/56))
- (_Internal_) Internalize `Validator` and topology (`Topology`, `ErgodicTopology`, `LeftRightTopology`) classes. ([#57](https://github.com/eonu/sequentia/pull/57))
- (_Internal_) Use proper documentation format for topology classes. ([#58](https://github.com/eonu/sequentia/pull/58))

## [0.5.0](https://github.com/eonu/sequentia/releases/tag/v0.5.0)

#### Major changes

- Add `Preprocess.summary()` to display an ordered summary of preprocessing transformations. ([#54](https://github.com/eonu/sequentia/pull/54))
- Add mean and median filtering preprocessing methods. ([#48](https://github.com/eonu/sequentia/pull/48))
- Use median filtering and decimation downsampling by default. ([#52](https://github.com/eonu/sequentia/pull/52))
Expand All @@ -44,17 +68,14 @@
## [0.4.0](https://github.com/eonu/sequentia/releases/tag/v0.4.0)

#### Major changes

- Re-add `euclidean` metric as `DTWKNN` default. ([#43](https://github.com/eonu/sequentia/pull/43))

#### Minor changes

- Add explicit labels to `evaluate()` in `HMMClassifier` example. ([#44](https://github.com/eonu/sequentia/pull/44))

## [0.3.0](https://github.com/eonu/sequentia/releases/tag/v0.3.0)

#### Major changes

- Add proper documentation, hosted on [Read The Docs](https://sequentia.readthedocs.io/en/latest). ([#40](https://github.com/eonu/sequentia/pull/40), [#41](https://github.com/eonu/sequentia/pull/41))

## [0.2.0](https://github.com/eonu/sequentia/releases/tag/v0.2.0)
Expand All @@ -77,5 +98,4 @@
## [0.1.0](https://github.com/eonu/sequentia/releases/tag/v0.1.0)

#### Major changes

Nothing, initial release!
42 changes: 20 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@

## Introduction

<img src="https://i.ibb.co/gPymgs4/classifier.png" width="40%" align="right"></img>

Temporal sequences are sequences of observations that occur over time. Changing patterns over time naturally provide many interesting opportunities and challenges for machine learning.

This library specifically aims to tackle classification problems for isolated temporal sequences by creating an interface to a number of classification algorithms.
Expand All @@ -40,39 +38,39 @@ Despite these types of sequences sounding very specific, you probably observe so

**Some examples of classification problems for isolated temporal sequences include classifying**:

- isolated word utterances in speech audio signals,
- isolated hand-written characters according to their pen-tip trajectories,
- isolated hand or head gestures in a video or motion-capture recording.
- word utterances in speech audio signals,
- hand-written characters according to their pen-tip trajectories,
- hand or head gestures in a video or motion-capture recording.

## Features

Sequentia offers the use of **multivariate observation sequences with differing durations** in conjunction with the following algorithms and methods.
Sequentia offers the use of multivariate observation sequences with varying durations in conjunction with the following algorithms and methods:

### Classication algorithms
### Classification algorithms

- [x] Hidden Markov Models (via [Pomegranate](https://github.com/jmschrei/pomegranate) [[1]](#references))
- [x] Multivariate Gaussian Emissions
- [ ] Gaussian Mixture Model Emissions (_soon!_)
- [x] Left-Right and Ergodic Topologies
- [x] Multivariate Gaussian emissions
- [x] Gaussian Mixture Model emissions (full and diagonal covariances)
- [x] Left-right and ergodic topologies
- [x] Approximate Dynamic Time Warping k-Nearest Neighbors (implemented with [FastDTW](https://github.com/slaypni/fastdtw) [[2]](#references))
- [x] Custom distance-weighted predictions
- [x] Multi-processed predictions
- [ ] Long Short-Term Memory Networks (_soon!_)

### Preprocessing methods

- [x] Centering and standardization
- [x] Downsampling (decimation and averaging)
- [x] Filtering (mean and median)
- [x] Discrete Fourier Transform

### Parallelization
<p align="center">
<img src="https://i.ibb.co/jVD2S4b/classifier.png" width="60%"/><br/>
Example of a classification algorithm: a multi-class HMM isolated sequence classifier
</p>

- [x] Multi-processing for DTW k-NN predictions
### Preprocessing methods

> **Disclaimer**: The package currently remains largely untested and is still in its early pre-alpha stages – _use with caution_!
- [x] Centering, standardization and min-max scaling
- [x] Decimation and mean downsampling
- [x] Mean and median filtering

## Installation

```
```console
pip install sequentia
```

Expand All @@ -82,7 +80,7 @@ Documentation for the package is available on [Read The Docs](https://sequentia.

## Tutorials and examples

For tutorials and examples on the usage of Sequentia, [look at the notebooks here](https://nbviewer.jupyter.org/github/eonu/sequentia/tree/master/notebooks/)!
For tutorials and examples on the usage of Sequentia, [look at the notebooks here](https://nbviewer.jupyter.org/github/eonu/sequentia/tree/master/notebooks/).

## References

Expand Down
11 changes: 11 additions & 0 deletions docs/_includes/examples/classifiers/gmmhmm.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import numpy as np
from sequentia.classifiers import GMMHMM

# Create some sample data
X = [np.random.random((10 * i, 3)) for i in range(1, 4)]

# Create and fit a left-right HMM with random transitions and initial state distribution
hmm = GMMHMM(label='class1', n_states=5, n_components=3, covariance='diagonal', topology='left-right')
hmm.set_random_initial()
hmm.set_random_transitions()
hmm.fit(X)
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import numpy as np
from sequentia.classifiers import DTWKNN
from sequentia.classifiers import KNNClassifier

# Create some sample data
X = [np.random.random((10 * i, 3)) for i in range(1, 4)]
y = ['class0', 'class1', 'class1']

# Create and fit the classifier
clf = DTWKNN(k=1, radius=5)
clf = KNNClassifier(k=1, radius=5)
clf.fit(X, y)

# Predict labels for the training data (just as an example)
Expand Down
8 changes: 0 additions & 8 deletions docs/_includes/examples/preprocessing/center.py

This file was deleted.

8 changes: 0 additions & 8 deletions docs/_includes/examples/preprocessing/downsample.py

This file was deleted.

8 changes: 0 additions & 8 deletions docs/_includes/examples/preprocessing/fft.py

This file was deleted.

8 changes: 0 additions & 8 deletions docs/_includes/examples/preprocessing/filtrate.py

This file was deleted.

20 changes: 0 additions & 20 deletions docs/_includes/examples/preprocessing/preprocess.py

This file was deleted.

8 changes: 0 additions & 8 deletions docs/_includes/examples/preprocessing/standardize.py

This file was deleted.

10 changes: 0 additions & 10 deletions docs/_includes/examples/preprocessing/trim_zeros.py

This file was deleted.

Empty file removed docs/_static/.gitkeep
Empty file.
Binary file added docs/_static/classifier.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
author = 'Edwin Onuonga'

# The full version, including alpha/beta/rc tags
release = '0.6.1'
release = '0.7.0'

# -- General configuration ---------------------------------------------------

Expand Down
8 changes: 5 additions & 3 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -39,18 +39,20 @@ Sequentia offers some appropriate classification algorithms for these kinds of t
:caption: Classifiers and Models

sections/classifiers/hmm.rst
sections/classifiers/dtwknn.rst
sections/classifiers/knn.rst

.. toctree::
:maxdepth: 1
:caption: Preprocessing Methods

sections/preprocessing/introduction.rst
sections/preprocessing/equalize.rst
sections/preprocessing/trim_zeros.rst
sections/preprocessing/min_max_scale.rst
sections/preprocessing/center.rst
sections/preprocessing/standardize.rst
sections/preprocessing/downsample.rst
sections/preprocessing/filtrate.rst
sections/preprocessing/fft.rst
sections/preprocessing/filter.rst
sections/preprocessing/preprocessing.rst

Documentation Search and Index
Expand Down
Loading