-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Open
Description
how can I predict the average value of an amount of data in an array?
For example i am use real currency using all the data in an array
var balance = [
'1,98',
'10,50',
'500,47',
'5.000,64',
'5.206,64',
'5.778,03',
'70.000,29',
'900.000,16',
'1.000.000,07'
]
How can I predict that the average balance is 5k and corresponds to 70% of the total of all the array?
I was looking at some examples and in the below it can predict what will be the next number of the array in order of 0 to 9
var my_data = [
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
0, 1, 2, 3, 4, 5, 6, 7, 8
];
var trainer = new convnetjs.SGDTrainer(net, { learning_rate: 0.01, momentum: 0.2, batch_size: 1, l2_decay: 0.001 });
var learn = function () {
for (var j = 0; j < 100; j++) {
for (var i = 0; i < my_data.length - d; i++) {
var data = my_data.slice(i, i + d);
var real_value = [my_data[i + d]];
var x = new convnetjs.Vol(data);
trainer.train(x, real_value);
var predicted_values = net.forward(x);
console.log("data: [" + data + "] -> value: " + real_value);
console.log("prediction in learn stage is: " + predicted_values.w[0]);
}
}
}
var predict = function (data) {
var x = new convnetjs.Vol(data);
var predicted_value = net.forward(x);
return predicted_value.w[0];
}
learn();
var item = [0, 1, 2, 3, 4, 5, 6, 7, 8];
console.log("predicted value for [" + item + "] is: " + predict(item));
is it possible to learn deeply to predict the average values of an array?
Thanks a lot for the help 👍
Metadata
Metadata
Assignees
Labels
No labels