-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[add:docs] Add proper documentation (#40)
* Add proper documentation * Remove and ignore docs/_build directory
- Loading branch information
Showing
28 changed files
with
820 additions
and
968 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# Minimal makefile for Sphinx documentation | ||
# | ||
|
||
# You can set these variables from the command line, and also | ||
# from the environment for the first two. | ||
SPHINXOPTS ?= | ||
SPHINXBUILD ?= sphinx-build | ||
SOURCEDIR = . | ||
BUILDDIR = _build | ||
|
||
# Put it first so that "make" without argument is like "make help". | ||
help: | ||
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) | ||
|
||
.PHONY: help Makefile | ||
|
||
# Catch-all target: route all unknown targets to Sphinx using the new | ||
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). | ||
%: Makefile | ||
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import numpy as np | ||
from sequentia.classifiers import DTWKNN | ||
|
||
# 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.fit(X, y) | ||
|
||
# Predict labels for the training data (just as an example) | ||
clf.predict(X) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import numpy as np | ||
from sequentia.classifiers import HMM | ||
|
||
# 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 = HMM(label='class1', n_states=5, topology='left-right') | ||
hmm.set_random_initial() | ||
hmm.set_random_transitions() | ||
hmm.fit(X) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import numpy as np | ||
from sequentia.classifiers import HMM, HMMClassifier | ||
|
||
# Create and fit some sample HMMs | ||
hmms = [] | ||
for i in range(5): | ||
hmm = HMM(label=f'class{i}', n_states=(i + 3), topology='left-right') | ||
hmm.set_random_initial() | ||
hmm.set_random_transitions() | ||
hmm.fit([np.arange((i + j * 20) * 30).reshape(-1, 3) for j in range(1, 4)]) | ||
hmms.append(hmm) | ||
|
||
# Create some sample test data and labels | ||
X = [np.random.random((10 * i, 3)) for i in range(1, 4)] | ||
y = ['class0', 'class1', 'class1'] | ||
|
||
# Create a classifier and calculate predictions and evaluations | ||
clf = HMMClassifier() | ||
clf.fit(hmms) | ||
predictions = clf.predict(X) | ||
accuracy, confusion = clf.evaluate(X, y) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import numpy as np | ||
from sequentia.preprocessing import downsample | ||
|
||
# Create some sample data | ||
X = [np.random.random((10 * i, 3)) for i in range(1, 4)] | ||
|
||
# Downsample the data with downsample factor 5 and decimation | ||
X = downsample(X, n=5, method='decimate') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import numpy as np | ||
from sequentia.preprocessing import fft | ||
|
||
# Create some sample data | ||
X = [np.random.random((10 * i, 3)) for i in range(1, 4)] | ||
|
||
# Transform the data | ||
X = fft(X) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import numpy as np | ||
from sequentia.preprocessing import normalize | ||
|
||
# Create some sample data | ||
X = [np.random.random((10 * i, 3)) for i in range(1, 4)] | ||
|
||
# Normalize the data | ||
X = normalize(X) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import numpy as np | ||
from sequentia.preprocessing import Preprocess | ||
|
||
# Create some sample data | ||
X = [np.random.random((10 * i, 3)) for i in range(1, 4)] | ||
|
||
# Create the Preprocess object | ||
pre = Preprocess() | ||
pre.normalize() | ||
pre.downsample(10, method='average') | ||
pre.fft() | ||
|
||
# Transform the data applying transformations in order | ||
X = pre.transform(X) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
.. _changelog: | ||
|
||
Changelog | ||
========= | ||
|
||
.. mdinclude:: ../CHANGELOG.md |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
# Configuration file for the Sphinx documentation builder. | ||
# | ||
# This file only contains a selection of the most common options. For a full | ||
# list see the documentation: | ||
# https://www.sphinx-doc.org/en/master/usage/configuration.html | ||
|
||
# -- Path setup -------------------------------------------------------------- | ||
|
||
import sys | ||
import os | ||
import subprocess | ||
|
||
# If extensions (or modules to document with autodoc) are in another directory, | ||
# add these directories to sys.path here. If the directory is relative to the | ||
# documentation root, use os.path.abspath to make it absolute, like shown here. | ||
sys.path.insert(0, os.path.abspath('..')) | ||
|
||
subprocess.call('pip install numpydoc sphinx_rtd_theme m2r', shell=True) | ||
|
||
# -- Project information ----------------------------------------------------- | ||
|
||
project = 'sequentia' | ||
copyright = '2019-2020, Edwin Onuonga' | ||
author = 'Edwin Onuonga' | ||
|
||
# The full version, including alpha/beta/rc tags | ||
release = '0.2.0' | ||
|
||
# -- General configuration --------------------------------------------------- | ||
|
||
# Add any Sphinx extension module names here, as strings. They can be | ||
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom | ||
# ones. | ||
extensions = [ | ||
'sphinx.ext.autodoc', | ||
'sphinx.ext.autosummary', | ||
'sphinx.ext.mathjax', | ||
'sphinx.ext.viewcode', | ||
'numpydoc', | ||
'm2r' | ||
] | ||
|
||
autodoc_member_order = 'bysource' | ||
autosummary_generate = True | ||
numpydoc_show_class_members = False | ||
|
||
# The suffix(es) of source filenames. | ||
# You can specify multiple suffix as a list of string: | ||
source_suffix = ['.rst', '.md'] | ||
|
||
# Add any paths that contain templates here, relative to this directory. | ||
templates_path = ['_templates'] | ||
|
||
# List of patterns, relative to source directory, that match files and | ||
# directories to ignore when looking for source files. | ||
# This pattern also affects html_static_path and html_extra_path. | ||
exclude_patterns = ['_build'] | ||
|
||
# -- Options for HTML output ------------------------------------------------- | ||
|
||
# The theme to use for HTML and HTML Help pages. See the documentation for | ||
# a list of builtin themes. | ||
# | ||
html_theme = 'sphinx_rtd_theme' | ||
|
||
# Add any paths that contain custom static files (such as style sheets) here, | ||
# relative to this directory. They are copied after the builtin static files, | ||
# so a file named "default.css" will overwrite the builtin "default.css". | ||
html_static_path = ['_static'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
.. Sequentia documentation master file, created by | ||
sphinx-quickstart on Sat Dec 28 19:22:34 2019. | ||
You can adapt this file completely to your liking, but it should at least | ||
contain the root `toctree` directive. | ||
.. image:: https://i.ibb.co/42GkhfR/sequentia.png | ||
:alt: Sequentia | ||
:width: 275 | ||
:target: https://github.com/eonu/sequentia | ||
|
||
About | ||
===== | ||
|
||
Sequentia is a collection of machine learning algorithms for performing the classification of isolated temporal sequences. | ||
|
||
Each isolated sequence is generally modeled as a section of a longer multivariate time series | ||
that represents the entire sequence. Naturally, this fits the description of many types of problems such as: | ||
|
||
- isolated word utterance frequencies in speech audio signals, | ||
- isolated hand-written character pen-tip trajectories, | ||
- isolated hand or head gestures positions in a video or motion-capture recording. | ||
|
||
Most modern machine learning algorithms won't work directly out of the box when applied to such | ||
sequential data – mostly due to the fact that the dependencies between observations at different | ||
time frames must be considered, and also because each isolated sequence generally has a different duration. | ||
|
||
Sequentia offers some appropriate classification algorithms for these kinds of tasks. | ||
|
||
.. toctree:: | ||
:maxdepth: 1 | ||
:hidden: | ||
:caption: Sequentia | ||
|
||
self | ||
changelog.rst | ||
|
||
.. toctree:: | ||
:maxdepth: 1 | ||
:caption: Classifiers and Models | ||
|
||
sections/classifiers/hmm.rst | ||
sections/classifiers/dtwknn.rst | ||
|
||
.. toctree:: | ||
:maxdepth: 1 | ||
:caption: Preprocessing Methods | ||
|
||
sections/preprocessing/normalize.rst | ||
sections/preprocessing/downsample.rst | ||
sections/preprocessing/fft.rst | ||
sections/preprocessing/preprocessing.rst | ||
|
||
Documentation Search and Index | ||
============================== | ||
|
||
* :ref:`search` | ||
* :ref:`genindex` | ||
* :ref:`modindex` |
Oops, something went wrong.