生成新的未知点并检查您的感知器是否可以猜测正确的答案:
// Test Against Unknown Data
const counter = 500;
for (let i = 0; i < counter; i++) {
let x = Math.random() * xMax;
let y = Math.random() * yMax;
let guess = ptron.activate([x, y, ptron.bias]);
let color = "black";
if (guess == 0) color = "blue";
plotter.plotPoint(x, y, color);
}
添加一个计数器来计算错误数:
// Test Against Unknown Data
const counter = 500;
let errors = 0;
for (let i = 0; i < counter; i++) {
let x = Math.random() * xMax;
let y = Math.random() * yMax;
let guess = ptron.activate([x, y, ptron.bias]);
let color = "black";
if (guess == 0) color = "blue";
plotter.plotPoint(x, y, color);
if ((y > f(x) && guess == 0) || (y < f(x) && guess == 1)) {errors++}
}
如何调整感知器?
以下是一些建议:
截取页面反馈部分,让我们更快修复内容!也可以直接跳过填写反馈内容!