diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..b512c09 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +node_modules \ No newline at end of file diff --git a/data.json b/data.json new file mode 100644 index 0000000..57dc63d --- /dev/null +++ b/data.json @@ -0,0 +1,40 @@ +[ + { + "input": "Inside Chi's nursery", + "output": "kardashian" + }, + { + "input": "Why I dyed my hair pink", + "output": "kardashian" + }, + { + "input": "Feeling Blue (wearing @kkwbeauty powder contour in medium & dark contour kit as eye shadow, & a new lip coming soon)", + "output": "kardashian" + }, + { + "input": "The Classic Blossom Palette is SOLD OUT 🌸 Can’t wait to see all your looks with this! Sign up for restock updates: https://kkwbeauty.com/pages/signup )", + "output": "kardashian" + }, + { + "input": "Awww this part of GABBANA makes me so sad 😢😢😢", + "output": "kardashian" + }, + + + { + "input": "Dem Memo: FBI did not disclose who the clients were - the Clinton Campaign and the DNC. Wow!", + "output": "trump" + }, + { + "input": "Thank you to the great men and women of the United States @SecretService for a job well done!", + "output": "trump" + }, + { + "input": "Congressman Lee Zeldin is doing a fantastic job in D.C. Tough and smart, he loves our Country and will always be there to do the right thing. He has my Complete and Total Endorsement!", + "output": "trump" + }, + { + "input": "China is actually placing propaganda ads in the Des Moines Register and other papers, made to look like news. That’s because we are beating them on Trade, opening markets, and the farmers will make a fortune when this is over!", + "output": "trump" + } +] \ No newline at end of file diff --git a/index.js b/index.js new file mode 100644 index 0000000..94791a7 --- /dev/null +++ b/index.js @@ -0,0 +1,18 @@ +const brain = require('brain.js'); +const data = require('./data.json'); + +const network = new brain.recurrent.LSTM(); + +const trainingData = data.map(item => ({ + input : item.input, + output : item.output +})); + +network.train(trainingData,{ + iterations : 100 +}); + +const output = network.run("Jobless Claims fell to their lowest level in 49 years!"); + + +console.log(`Person: ${output}`); \ No newline at end of file diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 0000000..9c5df64 --- /dev/null +++ b/package-lock.json @@ -0,0 +1,35 @@ +{ + "name": "Machine_Learning_in_JavaScript", + "version": "1.0.0", + "lockfileVersion": 1, + "requires": true, + "dependencies": { + "acorn": { + "version": "5.7.3", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-5.7.3.tgz", + "integrity": "sha512-T/zvzYRfbVojPWahDsE5evJdHb3oJoQfFbsrKM7w5Zcs++Tr257tia3BmMP8XYVjp1S9RZXQMh7gao96BlqZOw==" + }, + "brain.js": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/brain.js/-/brain.js-1.4.1.tgz", + "integrity": "sha512-HeU36gd0YhRs+jbz1HdcyOkPcjtgpQpnDhu2vJl3urDTZ2JUBxMstt11dvvUoet4lvL71iGhKKFEg21J3X+BBw==", + "requires": { + "gpu.js": "1.8.1", + "thaw.js": "2.0.0" + } + }, + "gpu.js": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/gpu.js/-/gpu.js-1.8.1.tgz", + "integrity": "sha512-Glpgu8JihpzLo3OZXtdoKCWIE/W61cjNGwb27RXvXAhCnE/DSz3/PeL6rYpk56yZAvjMgXlgAN6NM7fot0NNFQ==", + "requires": { + "acorn": "5.7.3" + } + }, + "thaw.js": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/thaw.js/-/thaw.js-2.0.0.tgz", + "integrity": "sha1-RSvF1+4s4bb5IDewW1BsvWVikdA=" + } + } +} diff --git a/package.json b/package.json new file mode 100644 index 0000000..dcd8040 --- /dev/null +++ b/package.json @@ -0,0 +1,15 @@ +{ + "name": "Machine_Learning_in_JavaScript", + "version": "1.0.0", + "description": "", + "main": "index.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "keywords": [], + "author": "", + "license": "ISC", + "dependencies": { + "brain.js": "^1.4.1" + } +}