bugl
bugl
HomeLearnPatternsPathsSearchPremium
HomeLearnPatternsPaths
Learn/AI/Machine Learning
AI•Machine Learning

Testing a Perceptron

A Perceptron must be Tested and Evaluated .

A Perceptron must be tested against Real Values .

Test Your Library

Generate new unknown points and check if your Perceptron can guess the right answers:

Example

// 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);
}

Count the Errors

Add a counter to count the number of errors:

Example

// 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++}
}

Tune the Perceptron

How can you tune the Perceptron?

Here are some suggestions

  • Adjust the learning rate
  • Increase the number of training data
  • Increase the number of training iterations

Previous

Pattern Recognition

Next

Machine Learning

This chapter

Overview
16

Lessons

69m

Read time

1. Machine Learning2. Artificial Intelligence3. Machine Learning Languages4. Machine Learning in JavaScript5. Linear Graphs6. Scatter Plots7. Perceptrons8. Pattern Recognition9. Testing a Perceptron10. Machine Learning11. ML Terminology12. Machine Learning Data13. Data Clusters14. Linear Regressions15. Deep Learning (DL)16. Brain.js

On this page

Test Your LibraryCount the ErrorsTune the Perceptron