2015-03-23 18:28:29 +00:00
|
|
|
#include <iostream>
|
|
|
|
#include <exception>
|
|
|
|
|
|
|
|
#include "Net.h"
|
|
|
|
|
|
|
|
int main()
|
|
|
|
{
|
|
|
|
try
|
|
|
|
{
|
|
|
|
std::cout << "Neuro running" << std::endl;
|
|
|
|
|
2015-10-15 17:18:26 +00:00
|
|
|
std::vector<double> inputValues = { 1.0, 4.0, 5.0 };
|
|
|
|
std::vector<double> targetValues = { 3.0 };
|
2015-03-23 18:28:29 +00:00
|
|
|
|
2015-10-15 17:18:26 +00:00
|
|
|
Net myNet({ inputValues.size(), 4, targetValues.size() });
|
2015-03-23 18:28:29 +00:00
|
|
|
|
2015-10-15 17:18:26 +00:00
|
|
|
myNet.feedForward(inputValues);
|
|
|
|
|
|
|
|
std::vector<double> outputValues = myNet.getOutput();
|
2015-03-23 18:28:29 +00:00
|
|
|
|
|
|
|
std::cout << "Result: ";
|
2015-10-15 17:18:26 +00:00
|
|
|
for (double &value : outputValues)
|
2015-03-23 18:28:29 +00:00
|
|
|
{
|
|
|
|
std::cout << value << " ";
|
|
|
|
}
|
|
|
|
std::cout << std::endl;
|
2015-10-15 17:18:26 +00:00
|
|
|
|
|
|
|
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;
|
|
|
|
}
|