perceptron implementation changed + perceptronLearningAlgorithm and tests
This commit is contained in:
16
tests/perceptron.cpp
Normal file
16
tests/perceptron.cpp
Normal file
@@ -0,0 +1,16 @@
|
||||
#include <NeuralNetwork/FeedForward/Perceptron.h>
|
||||
|
||||
#include <assert.h>
|
||||
#include <iostream>
|
||||
|
||||
int main() {
|
||||
NeuralNetwork::FeedForward::Perceptron p(2,1);
|
||||
|
||||
p[1].weight(0)=-1.0;
|
||||
p[1].weight(1)=1.001;
|
||||
|
||||
assert(p.computeOutput({1,1})[0] == 1.0);
|
||||
p[1].weight(1)=0.999;
|
||||
|
||||
assert(p.computeOutput({1,1})[0] == 0.0);
|
||||
}
|
||||
Reference in New Issue
Block a user