Project

dwarf

0.0
No commit activity in last 3 years
No release in over 3 years
Dwarf is an implementation of decision tree learning algorithms targeted for use in the Rails 3 console environment for classifying ActiveRecord objects.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 1.0.0
>= 0.3.1
>= 2.0.1
>= 0.7

Runtime

>= 0.8.1
 Project Readme

Dwarf Classifying

Dwarf provides a decision tree learning tool initially targeting classification of Rails 3 ActiveRecord objects. Dwarf is largely agnostic of types so long as they implement a few methods.

Install

gem install dwarf

This will install dwarf.

Classifying

Dwarf targets the interactive Rails console for the time being, though there is nothing preventing it from being used in your code as well. Suppose you have some records (record1, record2, ... , recordN) that you know the classifications of. Instantiate a Classifier, inform the instance of the classifications via the add_example method, and then call learn!. The classifier will build a decision tree from your examples as well as a classify method to classify arbitrary instances you hand it.

Teaching:

classifier = Dwarf::Classifier.new()
classifier.add_example(record1, :good)
classifier.add_example(record2, :good)
classifier.add_example(record3, :bad)
.
.
.
classifier.add_example(recordN, :bad)
classifier.learn!

Classifying

classifier.classify(record1) => :good
classifier.classify(unseen_record) => :good

Dwarf will make a best guess attempt to classify records it has not seen yet. If the features of a record are not sufficient to classify it (e.g. two or more records have the same features, but different classifications) Dwarf will always guess the classification it has seen most often for that particular feature set.

Contribute

Fork the dwarf project on github (http://github.com/aredington/dwarf), document your changes, and then send a pull request.