This repository has been archived on 2024-12-15. You can view files and clone it, but cannot push or open issues or pull requests.
Neuro/Neuro.cpp

43 lines
661 B
C++
Raw Normal View History

2015-03-23 18:28:29 +00:00
#include <iostream>
#include <exception>
#include <algorithm>
2015-03-23 18:28:29 +00:00
#include "Net.h"
int main()
{
try
{
std::cout << "Neuro running" << std::endl;
Net myNet({ 2, 3, 1 });
2015-03-23 18:28:29 +00:00
std::vector<double> inputValues =
{
0.1,
0.7,
};
2015-10-18 20:05:18 +00:00
std::vector<double> targetValues = { 0.7 };
2015-10-18 20:05:18 +00:00
myNet.feedForward(inputValues);
std::vector<double> outputValues = myNet.getOutput();
2015-03-23 18:28:29 +00:00
double error = outputValues[0] - targetValues[0];
2015-10-18 20:05:18 +00:00
std::cout << "Error: ";
std::cout << std::abs(error);
std::cout << std::endl;
myNet.backProp(targetValues);
2015-03-23 18:28:29 +00:00
}
catch (std::exception &ex)
{
std::cerr << "Error: " << ex.what() << std::endl;
return 1;
}
return 0;
}