xxxxxxxxxx
27
let brain;
function setup() {
createCanvas(200, 200);
const options = {
inputs: 2,
outputs: ['up', 'down', 'stay'],
task: 'classification',
noTraining: true
}
brain = ml5.neuralNetwork(options);
y = height/2;
}
let y;
function draw() {
background(0);
ellipse(100, y, 20, 20);
let inputs = [mouseX/width, mouseY/height];
let results = brain.classifySync(inputs);
console.log(results[0].label);
// y += random(-1,1);
brain.mutate();
}