Reputation: 4888
I want to create a training set from a CSV file a normalize it to either [0, 1] or [-1, 1] range (according to what activation function is chosen by a user). How can I do that? After reading Encog tutorials and guides I have something like this:
var source = new CSVDataSource(openFileDialog.FileName, true, CSVFormat.DecimalPoint);
data = new VersatileMLDataSet(source);
data.DefineSourceColumn("x", 0, ColumnType.Continuous);
var outputColumnDefinition = data.DefineSourceColumn("y", 1, ColumnType.Continuous);
data.Analyze();
data.DefineSingleOutputOthersInput(outputColumnDefinition);
data.Normalize();
According to the API documentation the Normalize()
method takes no arguments and
Normalizes the data set, and allocates memory to hold it.
What range does it normalize to? Can I force it to use a differenct one? Maybe it's not the correct way of loading training data from a CSV and normalizing it in memory?
I want to use a simple feedforward network using backpropagation for a regression problem.
Upvotes: 1
Views: 999
Reputation: 3288
Probably the easiest way is just to assign a normalization strategy for the range you want. This specifies the input range to -1,1 and the output range to the same.
data.NormHelper.NormStrategy = new BasicNormalizationStrategy(-1,1,-1,1);
When you select a model, using:
model.SelectMethod(data, MLMethodFactory.TypeFeedforward);
Encog will automatically create a normalization strategy based on your activation function. So if you are going to override the strategy, make sure you do it after you set the model(if you are using code similar to above) An example is here:
Upvotes: 1