mikeizbicki / HLearn

Homomorphic machine learning
Other
1.62k stars 135 forks source link

no instance (Classifier (Perceptron Bool Vector2)) error #21

Closed ghost closed 11 years ago

ghost commented 11 years ago

The example perceptron.hs in HLearn/HLearn-classification/src/examples/perceptron.hs seems to be broken.

When I run the example, it gives me an error --

    No instance for (Classifier (Perceptron Bool Vector2))
  arising from a use of `classify'
Possible fix:
  add an instance declaration for
  (Classifier (Perceptron Bool Vector2))
In the second argument of `(.)', namely `classify p'
In the first argument of `map', namely `(letter . classify p)'
In the first argument of `map', namely
  `(map (letter . classify p))'

The error is a little hard to understand. If someone can guide me a little, I would like to correct the bug and initiate a pull request...

mikeizbicki commented 11 years ago

This error is a result of a mistake in the library itself. I did some refactoring of the Classifier class a while back and apparently forgot to update the Perceptron type.

I've fixed the problem in the dev branch on github, and removed some of the excess code in the example. If you still want to do some hacking, some fun ways to extend the example would be to:

1) get data from a file 2) automatically adjust the boundary of the ascii display so that things don't run off screen 3) print a graphical plot using gnuplot or something else

I'd be happy to give any pointers on going about this.