So, what keeps happening is i get the same output every single time for the network.GetOutputValue(). My guess would be that there has to be a problem with the calculation since it outputs it correctly the first time but outputs the same number every other time. Here is the input:
this is the description.
3 30 Pass
1 12 Run
4 10 Pass
2 4 Pass
Here is the output i get:
0.75 0.3 0.942474
0.25 0.12 0.942474
0.99 0.1 0.942474
0.5 0.04 0.942474
Here is the output i should get:
0.75 0.3 0.942474
0.25 0.12 0.819178
0.99 0.1 0.949462
0.5 0.04 0.850639
#ifndef ANN_H
#define ANN_H
#include <iostream>
#include <vector>
#include "TrainData.h"
usingnamespace std;
class Neuron {
protected:
vector<double> weights; //The weights of the neurons
double theNeuron; //the calculated neuron
public:
void PrintWeights(); //function that Print the weights
void SetWeights(int n); //function that sets the weights
};
class HiddenNeuron : public Neuron {
private:
vector<double> neurons; //vector of calculated neurons
public:
void SetNeuronData(double down, double pass, int i); //sets the neuron data
double GetNeuronData(int i) const; //gets the neuron data
};
class OutputNeuron : public Neuron {
public:
void SetNeuronData(HiddenNeuron neurons);//sets the neuron data
double GetNeuronData() const;//gets the neuron data
};
class ANN {
private:
HiddenNeuron hidden; // the hidden neurons
OutputNeuron output; // the output neuron
public:
double GetOutputValue() const; // function that gets the outputneuron value
void JustDoIt(); // function that runs parts of the hidden neuron
void SetData(double down, double yards); //function that calls setneuron function
};
#endif
//*****************************************************************************
#include <iostream>
#include <fstream>
#include <string>
#include "TrainData.h"
#include "ANN.h"
usingnamespace std;
//*****************************************************************************
int main()
{
ANN network; // the Neural network
TrainingSet footballData; // the football training set
string fileName;
int i; // a counter variable
TrainingEntry entry; // training entry variable
double down; // a down variable
double yards; // a yards variable
cout << "Enter the name of the file with all of the training data." << endl
cin >> fileName;
footballData.OpenFile(fileName);
footballData.SetEntry();
cout << endl << footballData.GetDescription() << endl;
network.JustDoIt();
for(i = 0; i < footballData.GetNumberOfEntries(); i++)
{
entry = footballData.GetTrainingEntries(i);
yards = entry.GetNormalizedYTG();
down = entry.GetNormalizedDown();
network.SetData(down, yards);
cout << down << " " << yards << " " << network.GetOutputValue() << endl;
}// end for
return 0;
}