perceptron 0.1.1

A super fast online learning library using perceptron
Documentation
  • Coverage
  • 20%
    1 out of 5 items documented1 out of 5 items with examples
  • Size
  • Source code size: 9.34 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 1.5 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Links
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • elikip

Super fast online learning using perceptron. It allows you to train your model as you go, and use an ensemble to make accurate predictions.

Background

Preceptron is a relatively simple and fast machine learning algorithm. It has

  • no hyper parameters (no need to tune),
  • good generalization properties using ensemble and
  • overall good classification accuracy.

Usage

   use perceptron::*;

   fn and_works() {
       let examples = vec!((vec!(-1.0, 1.0), false), (vec!(-1.0, -1.0), false), (vec!(1.0, -1.0), false), (vec!(1.0, 1.0), true));
       let perceptron = (1..100).fold(Perceptron::new(2), 
			|pepoch, _epoch| examples.iter().fold(pepoch, 
			|pexample, example| pexample.train(example.0.clone(), example.1).unwrap()));

       println!("{:?}", perceptron);

       assert_eq!(perceptron.predict(examples[0].0.clone()), examples[0].1);
       assert_eq!(perceptron.predict(examples[1].0.clone()), examples[1].1);
       assert_eq!(perceptron.predict(examples[2].0.clone()), examples[2].1);
       assert_eq!(perceptron.predict(examples[3].0.clone()), examples[3].1);
   }