Value1.concat is not a function error
See original GitHub issueHi Guys I Just started Exploring brain.js and facing some issue
const brain = require('brain.js');
const faker = require('faker');
const co = require('co');
let payload = [];
const generateData = function () {
return new Promise((resolve,reject) => {
const result = {input: {
color: faker.commerce.color(),
price: faker.commerce.price()
}, output: { [faker.commerce.product()] : 1 } }
return resolve(result);
})
}
for (let index = 0; index < 100; index++) {
payload.push(generateData());
}
Promise.all(payload).then(result => {
console.log(result);
var net = new brain.recurrent.LSTM();
net.train(result)
var output = net.run({ color: faker.commerce.color, price: faker.commerce.price });
console.log(output);
})
Above is My Code where i am trying to Generate Some Fake eCommerce Data of Product with price and color attribute and output as a name of product
But i am getting following Error
UnhandledPromiseRejectionWarning: TypeError: value1.concat is not a function
at DataFormatter.toIndexesInputOutput (F:\demo\brain.js-demo\node_modules\brain.js\dist\utilities\data-formatter.js:103:40)
at LSTM.formatDataIn (F:\demo\brain.js-demo\node_modules\brain.js\dist\recurrent\rnn.js:766:35)
at LSTM.setupData (F:\demo\brain.js-demo\node_modules\brain.js\dist\recurrent\rnn.js:750:26)
at LSTM.train (F:\demo\brain.js-demo\node_modules\brain.js\dist\recurrent\rnn.js:460:21)
at Promise.all.then.result (F:\demo\brain.js-demo\server.js:26:9)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:188:7)
at Function.Module.runMain (module.js:695:11)
at startup (bootstrap_node.js:191:16)
at bootstrap_node.js:612:3
(node:12504) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch
block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:12504) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
Can Anyone Help me out Understanding What am i Doing Wrong in my code ???
Issue Analytics
- State:
- Created 5 years ago
- Comments:15 (9 by maintainers)
Top Results From Across the Web
angular - Concat is not a function - Stack Overflow
Hello guys I'm trying to put the all comments in array to show at *ngFor but at subscribe data comes json object so...
Read more >Javascript runtime error (concat is not a function) - LeetCode
Works in my console, but the execution runtime says "concat is not a function", given an input of l1 = [1, 2, 3]....
Read more >Array.prototype.concat() - JavaScript - MDN Web Docs
The concat() method is used to merge two or more arrays. This method does not change the existing arrays, but instead returns a...
Read more >TypeScript - Array concat() - Tutorialspoint
concat () method returns a new array comprised of this array joined with two or more arrays. Syntax. array.concat(value1, value2, ..., valueN); ...
Read more >JavaScript Array concat() Method - GeeksforGeeks
This method does not alter the original arrays passed as ... var newArray = oldArray.concat(value1[, value2[, . ... function func() {.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Thnx for Help
Here is a New Stackblitz i have created https://stackblitz.com/edit/brain-js-demo
Lemme know if found any solutions