linear-classification-visualization
v1.0.0
Published
This is a simple visualization of linear classification using p5.js
Downloads
4
Maintainers
Readme
linear-classification-visualization
This is a simple visualization of linear classification using p5.js. It allows you to add points, calculate a best-fit line, and make guesses to compare against the computed line, displaying a score based on the accuracy of the guess.
Table of Contents
Installation
Using the p5.js Web Editor
- Go to the p5.js Web Editor.
- Create a new sketch.
- Add a new file named
index.js
and paste the library code into it.
Setting Up Locally
- Install the
- Inside this folder, create a
sketch.js
file and aindex.js
file. - Copy the library code into
index.js
.
Usage
- Include the p5.js library and the
index.js
library in your project. - Instantiate the
index
class in yoursketch.js
file. - Use the methods provided by the library to add points, calculate the line, and guess the line.
Example
sketch.js
let index;
function setup() {
index = new index(800, 600);
}
function draw() {
index.render();
}
function mousePressed() {
index.mousePressed(mouseX, mouseY);
}