Menu
×
   ❮     
HTML CSS JAVASCRIPT SQL PYTHON JAVA PHP HOW TO W3.CSS C C++ C# BOOTSTRAP REACT MYSQL JQUERY EXCEL XML DJANGO NUMPY PANDAS NODEJS R TYPESCRIPT ANGULAR GIT POSTGRESQL MONGODB ASP AI GO KOTLIN SASS VUE DSA GEN AI SCIPY AWS CYBERSECURITY DATA SCIENCE
     ❯   

感知器测试

感知器必须进行测试评估

感知器必须针对真实值进行测试。

测试你的库

生成新的未知点并检查你的感知器是否能够猜测正确的答案

示例

// 对未知数据进行测试
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);
}

自己试试 »


计算错误

添加一个计数器来计算错误的数量

示例

// 对未知数据进行测试
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++}
}

自己试试 »


调整感知器

如何调整感知器?

以下是一些建议

  • 调整学习率
  • 增加训练数据量
  • 增加训练迭代次数

×

Contact Sales

If you want to use W3Schools services as an educational institution, team or enterprise, send us an e-mail:
[email protected]

Report Error

If you want to report an error, or if you want to make a suggestion, send us an e-mail:
[email protected]

W3Schools is optimized for learning and training. Examples might be simplified to improve reading and learning. Tutorials, references, and examples are constantly reviewed to avoid errors, but we cannot warrant full correctness of all content. While using W3Schools, you agree to have read and accepted our terms of use, cookie and privacy policy.

Copyright 1999-2024 by Refsnes Data. All Rights Reserved. W3Schools is Powered by W3.CSS.