Tutorials References Exercises Videos NEW Menu
Paid Courses Website NEW

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

Try it Yourself »


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) &amp; guess == 0) {errors++}
}

Try it Yourself »


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