Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Perceptron with associative array #1

Open
erelsgl opened this issue May 27, 2013 · 0 comments
Open

Perceptron with associative array #1

erelsgl opened this issue May 27, 2013 · 0 comments

Comments

@erelsgl
Copy link

erelsgl commented May 27, 2013

I wrote a perceptron with a small modification - allowing the weights (and features) to be strings. This may be more natural in settings such as text caterogization. Example:

var bird = perceptron()
bird.train({'wings': 2, 'legs': 2}, 1)
bird.train({'wings': 0, 'legs': 2}, 0)
bird.train({'wings': 2, 'legs': 4}, 0)
bird.train({'wings': 0, 'legs': 4}, 0)
while(!bird.retrain());

test.equal(bird.perceive({'wings': 2, 'legs': 2}), 1)
test.equal(bird.perceive({'wings': 0, 'legs': 2}), 0)
test.equal(bird.perceive({'wings': 2, 'legs': 4}), 0)
test.equal(bird.perceive({'wings': 0, 'legs': 4}), 0)

Would you like to add it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant