With Simple Regression Code I am getting the Error
Uncaught Error: Based on the provided shape, [81], the tensor should have 81 values but has 162
Code to reproduce
let nn;
let counter = 0;
const options = {
task:'regression',
debug: true,
inputs:2,
outputs:1,
epochs:32
}
function setup(){
createCanvas(400, 400);
nn = ml5.neuralNetwork(options);
console.log(nn)
createTrainingData();
nn.normalizeData();
const trainingOptions={
batchSize: 24,
epochs: 10
}
nn.train(trainingOptions);
}
function finishedTraining(){
nn.predict([5], (err, results) => {
if(err){
console.log(err);
return;
}
console.log(results[0]);
let prediction = results[0]
print(prediction);
})
}
function createTrainingData(){
for(let i = 1; i < 10; i++){
for(let j = 1; j < 10; j++){
nn.addData([[i,j]], [j])
}
}
}
@sps014 - Hi there! Thanks for your question + thanks for your understanding of any delays in response.
I believe this can be fixed by removing the extra brackets you had around the inputs of `nn.addData().
function createTrainingData(){
for(let i = 1; i < 10; i++){
for(let j = 1; j < 10; j++){
nn.addData([i,j], [j])
}
}
}
If this resolves your issue, please feel free to close :) thanks!
@joeyklee Thanks , it worked
tysm 馃檹馃コ