bugl
bugl
HomeLearnPatternsSearch
HomeLearnPatternsSearch

Loading lesson path

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

Training a Perceptron

Next

Machine Learning