Simple max(a, b) test-net without iterations
This commit is contained in:
parent
f22e4221a1
commit
d4a22ecae7
1 changed files with 14 additions and 17 deletions
13
Neuro.cpp
13
Neuro.cpp
|
@ -1,5 +1,6 @@
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <exception>
|
#include <exception>
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
#include "Net.h"
|
#include "Net.h"
|
||||||
|
|
||||||
|
@ -9,18 +10,15 @@ int main()
|
||||||
{
|
{
|
||||||
std::cout << "Neuro running" << std::endl;
|
std::cout << "Neuro running" << std::endl;
|
||||||
|
|
||||||
Net myNet({ 3, 2, 1 });
|
Net myNet({ 2, 3, 1 });
|
||||||
|
|
||||||
for (int i = 0; i < 100000; ++i)
|
|
||||||
{
|
|
||||||
std::vector<double> inputValues =
|
std::vector<double> inputValues =
|
||||||
{
|
{
|
||||||
std::rand() / (double)RAND_MAX,
|
0.1,
|
||||||
std::rand() / (double)RAND_MAX,
|
0.7,
|
||||||
std::rand() / (double)RAND_MAX
|
|
||||||
};
|
};
|
||||||
|
|
||||||
std::vector<double> targetValues = { inputValues[2] };
|
std::vector<double> targetValues = { 0.7 };
|
||||||
|
|
||||||
myNet.feedForward(inputValues);
|
myNet.feedForward(inputValues);
|
||||||
|
|
||||||
|
@ -34,7 +32,6 @@ int main()
|
||||||
|
|
||||||
myNet.backProp(targetValues);
|
myNet.backProp(targetValues);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
catch (std::exception &ex)
|
catch (std::exception &ex)
|
||||||
{
|
{
|
||||||
std::cerr << "Error: " << ex.what() << std::endl;
|
std::cerr << "Error: " << ex.what() << std::endl;
|
||||||
|
|
Loading…
Reference in a new issue