/randomferns-python

Why Random Ferns? Because 10 lines of code [1].

Primary LanguagePython

Random Ferns in Python

This module is a basic implementation of Random Ferns that allows users to define their own weak learners (the tests performed at each node).

Classification example

These examples train on three spiral (without noise) and predict the whole plane. They try 4 different weak learners: axis aligned, linear, conic and parabolas.

python example_ferns.py

Using one single fern:

Axis aligned:

Linear:

Conic:

Parabola:

Using 50 ferns, with soft or hard decision boundaries:

Axis aligned:
 

Linear:
 

Conic:
 

Parabola:
 

Regression example

These examples train on two circles and predict the center of the bottom right quadrant (predicting the center of the image would be too easy!). They try 4 different weak learners: axis aligned, linear, conic and parabolas.

python example_ferns_regression.py

Using one single fern:

Axis aligned:

Linear:

Conic:

Parabola:

Using 50 ferns:

Axis aligned:

Linear:

Conic:

Parabola:

References

[1] M. Ozuysal, P. Fua and V. Lepetit, "Fast Keypoint Recognition in Ten Lines of Code",
Conference on Computer Vision and Pattern Recognition, Minneapolis, MI, June 2007.
http://cvlab.epfl.ch/software/ferns

[2] https://github.com/rened/RandomFerns.jl (Note that R. Donner uses averaging for regression)