/Electrostatic-Classifier

A classifier inspired by electrostatics. Works with weighted datasets.

Primary LanguagePython

Electrostatic Classifier

A classifier inspired by electrostatics. A demo can be found here.

A binary classification demo

Usage

from classifier import ElectroStaticClassifier
clf = ElectroStaticClassifier()

trainingdata = [[1,1], [1,2], [2,1], [3,1], [2,2], [0,3]]
traininglabels = [1, 1, 1, 0, 0, 0]
weights = [0.1, 0.5, 0.4, 0.2, 0.3, 0.1]

clf.fit(trainingdata, traininglabels, weights) #If weights are not given, every data point is assigned the same weight value

clf.predict([0.5, 2]) 
>>> [1]

Dependencies

  1. Numpy : A fundamental package for scientific computing with Python.