Created
November 11, 2011 20:17
-
-
Save deedubs/1359107 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Using machine learning to determine where people live. | |
var brain = require('brain'); | |
var bayes = new brain.BayesianClassifier(); | |
// Training the Machine about Toronto | |
bayes.train("Toronto, On", "Toronto"); | |
bayes.train("Greater Toronto Area, Ontario", "Toronto"); | |
bayes.train("toronto;on-canada", "Toronto"); | |
bayes.train("T.O.", "Toronto"); | |
// Training the Machine about Montreal | |
bayes.train("MTL", "Montreal"); | |
bayes.train("Montreal, QC", "Montreal"); | |
bayes.train("Montreal", "Montreal"); | |
// Seeing what the machine thinks of 'T Dot' | |
var category = bayes.classify("T Dot"); | |
console.log(category); | |
// | |
// Machine guesses Toronto |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment