Skip to main content

EVQ: Evolving Vector Quantization for Classification

Project description

EVQ

Evolving Vector Quantization for Classification of On-Line Data Streams

Note

Inspired by this algorithm and several others, I created a new one called SEVQ: https://github.com/sylwekczmil/sevq

Inspiration

Implementation done by Sylwester Czmil based on pseudocode and algorithm description from:

E. Lughofer, “Evolving Vector Quantization for Classification of On-Line Data Streams,” 2008 International Conference on Computational Intelligence for Modelling Control & Automation, 2008, pp.779-784, doi: 10.1109/CIMCA.2008.47.

Installation

# create venv and activate
# install algorithm
pip3 evq

Example usage

Training and prediction one sample at a time

from evq.algorithm import EVQ

c = EVQ(number_of_classes=2, vigilance=0.1)
c.partial_fit([-2, -2], 1)
c.partial_fit([-1, -1], 0)
c.partial_fit([1, 1], 0)
c.partial_fit([2, 2], 1)

print(c.predict([0, 0]))  # 0
print(c.predict([3, 3]))  # 1
print(c.predict([-3, -3]))  # 1

Training and prediction on multiple samples

from evq.algorithm import EVQ

c = EVQ(number_of_classes=2, vigilance=0.1)
c.fit(
    [[-2, -2], [-1, -1], [1, 1], [2, 2]],
    [1, 0, 0, 1],
    epochs=1, permute=False
)

print(c.predict([[0, 0], [3, 3], [-3, -3]]))  # [0, 1, 1]

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

evq-0.0.2.tar.gz (3.4 kB view hashes)

Uploaded Source

Built Distribution

evq-0.0.2-py2.py3-none-any.whl (4.0 kB view hashes)

Uploaded Python 2 Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page