A collection of classification algorithms in Clojure
Add this line to your project.clj
:dependencies [[pigeon "0.0.1"]]
Pigeon will accept a series of archetypes as java.util.Collections to be matched against, and then respond with the closest match given an unidentified input collection.
To instantiate the classifier, simply:
(def pigeon (pigeon.Classifier.))
To add archetypes to the classifier, provide an id
and an archetype
to the .add
method:
(.add pigeon "up" [(processing.core.PVector. 1 1 1) (processing.core.PVector. 2 2 2) (processing.core.PVector. 3 3 3)])
(.add pigeon "down" [(processing.core.PVector. 3 3 3) (processing.core.PVector. 2 2 2) (processing.core.PVector. 1 1 1)])
Then, to match against an unidentified collection, call .match
with it. It will return with the id of the closest archetype:
(.match pigeon [(processing.core.PVector. 1 1 0) (processing.core.PVector. 1 2 1) (processing.core.PVector. 3 2 1)])
---> "up"
Copyright © 2014 Ryan Spangler
Distributed under the Eclipse Public License either version 1.0 or (at your option) any later version.