Skip to content

Commit 1d74270

Browse files
author
marcel schneider
committed
- rated item will be now applied before next training of neural network
1 parent 9cf354d commit 1d74270

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

examples/recommendation-engine/index.html

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,17 +39,17 @@
3939

4040
function nextTry(rating){
4141
document.getElementById('result').innerHTML = '';
42-
42+
43+
if(undefined !== ratingItem){
44+
trainingData.push({ input: ratingItem.trainingInformation, output: { wanted: rating / 4 } });
45+
}
46+
4347
const network = new brain.NeuralNetwork({
4448
activation: 'sigmoid',
4549
hiddenLayers: [4]
4650
});
4751
network.train(trainingData);
48-
49-
if(undefined !== ratingItem){
50-
trainingData.push({ input: ratingItem.trainingInformation, output: { wanted: rating / 4 } });
51-
}
52-
52+
5353
let suggestionItemsText = '';
5454
let suggestionItems = [];
5555
for(i=0;i<itemsInStock.length;i++){

0 commit comments

Comments
 (0)