#machine-learning #hmm #hidden-markov-model #linear-prediction #vector-quantization

app ecoz2

Linear Predictive Coding Vector Quantization and Hidden Markov Modeling for Pattern Recognition

4 releases (2 breaking)

0.4.4 Aug 21, 2020
0.3.0 May 3, 2020
0.1.1 Mar 31, 2020
0.1.0 Mar 30, 2020

#64 in Machine learning

32 downloads per month



C 5K SLoC // 0.1% comments Rust 3K SLoC // 0.1% comments Python 1K SLoC // 0.1% comments SWIG 177 SLoC // 0.1% comments

ECOZ2 in Rust

This project is mainly a "front-end" to the original ecoz2 implementation in C, with some functionality implemented in Rust.

Installing and running

The ecoz2 executable is currently being built and released for Linux and MacOS, which you can find under releases.

Alternatively, you can also install the executable using Rust. For this you will also need a GNU gcc compiler on your machine. On Linux you can run:

$ CC=gcc cargo install ecoz2

and on a MacOS, something like:

$ CC=gcc-9 cargo install ecoz2

This may take some time to complete (example of output here).


$ ecoz2
ecoz2 0.3.35
ECOZ2 System

    ecoz2 <SUBCOMMAND>

    -h, --help       Prints help information
    -V, --version    Prints version information

    csv-show    Basic csv selection info
    cversion    Show version of C code
    help        Prints this message or the help of the given subcommand(s)
    hmm         HMM operations
    lpc         Linear prediction coding
    prd         Predictor file operations
    seq         Sequence file operations
    sgn         Signal operations
    vq          VQ operations

Starting with a set of acoustic signals (WAV format) on your machine, the typical use of the system will involve the following main subcommands in this general order:

  • ecoz2 lpc: takes *.wav and generates perdictor files *.prd
  • ecoz2 vq learn takes *.prd and generates codebooks *.cb
  • ecoz2 vq quantize takes *.cb and *.prd and generates observation sequences *.seq
  • ecoz2 hmm learn takes *.seq and generates an HMM model *.hmm
  • ecoz2 hmm classify takes *.hmm and *.seq and reports classification of the sequences


ecoz2 is included as a submodule, with selected functionality exposed via https://doc.rust-lang.org/cargo/reference/build-scripts.html.

$ cargo build [--release]


~298K SLoC