[英]Can Brain.js do a regression?
I'm trying to define a price for websites using some attributes like numbers of visists, categories, age... But the things is lineare regression is not accurate enought, so I would like to know if brain js can be train to do some sort of regression?我正在尝试使用访问者数量、类别、年龄等属性来定义网站的价格......但事情是线性回归不够准确,所以我想知道是否可以训练大脑 js 做一些某种回归?
I have a list of websites with all attributes and their price to train the NN and in my end just by sending the attributes I want the NN to return me the price我有一个网站列表,其中包含所有属性及其价格来训练 NN,最后只需发送我希望 NN 向我返回价格的属性
All you have to do is to represent each of your input
and output
between a range of [0-1]
您所要做的就是在
[0-1]
范围内表示您的每个input
和output
First combination would be of age ie from 0 to 1第一个组合将是年龄,即从 0 到 1
let 0.10
means 10
years old and remember that age cannot exceed more than 1.0
让
0.10
表示10
岁,记住age cannot exceed more than 1.0
Second combination would be of visits per hours/day/week from 0 to 1第二种组合是从 0 到 1 每小时/每天/每周的访问次数
let 0.25
means 25
visits per hour or you can represent 0.25
based on your own need of visits per hour/day/week etc.让
0.25
表示每小时访问25
次,或者您可以根据自己每小时/每天/每周访问的需要等来表示0.25
。
Third combination would be of different category, each having different value from 0 to 1第三个组合将属于不同类别,每个具有从 0 到 1 的不同值
let 0.01
represents first category for example sports
.让
0.01
代表第一类,例如sports
。
Fourth combination would be of output ie price
each having different value from 0 to 1第四种组合是 output 即
price
每个具有从 0 到 1 的不同值
let 0.30
represents price
equal to 30
dollar.让
0.30
代表price
等于30
美元。
const brain = require('brain.js');
const network = new brain.NeuralNetwork();
network.train([
// [age, visits, category] [price]
{ input: [0.10, 0.20, 0.40], output: [0.30] }, // 1 input
{ input: [0.10, 0.50, 0.50], output: [0.60] }, // 2 input
{ input: [0.10, 0.40, 0.60], output: [0.20] }, // 3 input
{ input: [0.10, 0.40, 0.50], output: [0.50] }, // 4 input
{ input: [0.10, 0.30, 0.30], output: [0.90] }, // 5 input
{ input: [0.10, 0.70, 0.30], output: [0.70] } // 6 input
]);
//multiply answer by 100 to get price value
const output = network.run([0.10, 0.50, 0.60])*100;
console.log(`Price: ${output}`); // output lies between 2 and 3 input
i-e 38.1325
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.