Skip to content

Instantly share code, notes, and snippets.

@irony
Created April 4, 2018 20:56
Show Gist options
  • Save irony/1dff90d57c97cba65b7abc3af21338a7 to your computer and use it in GitHub Desktop.
Save irony/1dff90d57c97cba65b7abc3af21338a7 to your computer and use it in GitHub Desktop.
LSTM
const brain = require('brain.js')
const net = new brain.recurrent.LSTM()
net.train([
{ input: 'Inside Chi’s nursery', output: { kardashian: 1 } },
{ input: 'Why I dyed my hair pink', output: { kardashian: 1 } },
{ input: 'Feeling Blue (wearing @kkwbeauty powder contour in medium & dark contour kit as eye shadow, & a new lip coming soon)', output: { kardashian: 1 } },
{ input: 'I will be interviewed by @JudgeJeanine on @FoxNews at 9:00 P.M. Enjoy!', output: { trump: 1 } },
{ input: 'Dem Memo: FBI did not disclose who the clients were — the Clinton Campaign and the DNC. Wow!', output: { trump: 1 } },
{ input: 'Thank you to the great men and women of the United States @SecretService for a job well done!', output: { trump: 1 } }
])
console.log(net.run('Whether we are Republican or Democrat, we must now focus on strengthening Background Checks!'))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment