Skip to content

Instantly share code, notes, and snippets.

@kmaher9
Created September 4, 2018 18:18
Show Gist options
  • Save kmaher9/f8c67a85ab6f327b59a0c22d8bd1c589 to your computer and use it in GitHub Desktop.
Save kmaher9/f8c67a85ab6f327b59a0c22d8bd1c589 to your computer and use it in GitHub Desktop.
net.train(inputs, {
log: true, // prints to the screen the error rate, and current iteration
errorThresh: 0.05, // a relatively high error margin - but I'm not shooting for 100% accuracy (and it's merely a test)
})
var testFileContent = fs.readFileSync(testFile) // read the entire sample file into memory
var output = net.run(testFileContent) // and then run it! This will predict the class for the testFile
console.log(output)
// output:
// [ business: 0.0043, tech: 0.8552]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment