Given this CSV (GoogleSheets). I'd like to leave the numeric values untouched. How can I actually make use of this data for training my feedforward network?
// Load and prepare training data
var dataSource = new CSVDataSource("trainingData.csv", true, CSVFormat.DecimalPoint);
var data = new VersatileMLDataSet(dataSource);
ColumnDefinition outputColumn = data.DefineSourceColumn("Action", ColumnType.Nominal);
data.DefineSingleOutputOthersInput(outputColumn);
data.Analyze();
// Build neural net
var neuralNet = BuildNeuralNet();
// Train neural net
var train = new Backpropagation(neuralNet, data);
int epoch = 1;
do
{
train.Iteration();
Console.WriteLine(@"Epoch #" + epoch + @" Error : " + train.Error);
epoch++;
} while (train.Error > errorThreshold);
That's the EncogError I get during execution: "The machine learning method has an input length of 5, but the training data has 0. They must be the same."
private static BasicNetwork BuildNeuralNet()
{
var net = new BasicNetwork();
net.AddLayer(new BasicLayer(null, true, m_inputNodeCount)); // input layer
net.AddLayer(new BasicLayer(new ActivationSigmoid(), true, m_hiddenNodeCount)); // #1 hidden layer
net.AddLayer(new BasicLayer(new ActivationSigmoid(), false, m_outputNodeCount)); // output layer
net.Structure.FinalizeStructure();
net.Reset(); // initializes the weights of the neural net
return net;
}
I just split the output column into three new ones (GoogleSheets). And all what I had to do is to load the CSV like this:
var trainingSet = EncogUtility.LoadCSV2Memory("trainingData.csv", neuralNet.InputCount, neuralNet.OutputCount, true, CSVFormat.English, false);