Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/victorqribeiro/perceptron
The simplest Perceptron you'll ever see
https://github.com/victorqribeiro/perceptron
machine-learning machine-learning-algorithms perceptron
Last synced: 8 days ago
JSON representation
The simplest Perceptron you'll ever see
- Host: GitHub
- URL: https://github.com/victorqribeiro/perceptron
- Owner: victorqribeiro
- License: mit
- Created: 2019-01-24T20:02:34.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2019-02-10T00:34:00.000Z (over 5 years ago)
- Last Synced: 2024-08-01T00:51:09.739Z (3 months ago)
- Topics: machine-learning, machine-learning-algorithms, perceptron
- Language: JavaScript
- Size: 123 KB
- Stars: 45
- Watchers: 2
- Forks: 6
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Perceptron
The simplest [Perceptron](https://en.wikipedia.org/wiki/Perceptron) you'll ever see.
## How to use
Let's suppose you have the following data set:
| Height (cm) | Weight (kg) | Class (0-1) |
|-------------|-------------|-------------|
| 180 | 80 | 0 |
| 175 | 67 | 0 |
| 100 | 30 | 1 |
| 120 | 32 | 1 |0 - adult
1 - childYou need to process the table to this format:
```
const x = [
[180, 80],
[175, 67],
[100, 30],
[120, 32]
];const y = [0,0,1,1];
```Then just create a new Perceptron passing the shape of the data (height and weight), the learning rate and the number of iterations. By default the learning rate is set to 0.01 and the number of iterations is set to 10.
```
const p = new Perceptron( x[0].length );
```Call the fit function
```
p.fit(x,y);
```And you're all set to make predictions
```
p.predict([178, 70])
```Super simple.
# Applications
[Can a simple perceptron drive a car in a game?](https://github.com/victorqribeiro/carGamePerceptron)