CPP
cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
// Simple implementation of
// Teaching perceptron math in C++
// add bias and 3rd weight for that bias
// by Mustafa K.
#include <iostream>
using namespace std;
// y = (a + b) * 1.5
float const LR = 0.01;
class Perceptron
{
float weights[2];
public:
Perceptron ()
{
weights[0] = 0.5;
weights[1] = 0.5;
}
float guess (float inputs[2])
{
Enter to Rename, Shift+Enter to Preview
OUTPUT
Run