I'm a new student! I wanted to try to make a neural network and solve the regression problem for Boston data. I don't quite understand what function to use for this and network settings in Accord. My code is below. Please tell me if I am preparing the data correctly and submitting it to the network for training. And which activation function to use?
i try this:
System.Globalization.CultureInfo customCulture = (System.Globalization.CultureInfo)System.Threading.Thread.CurrentThread.CurrentCulture.Clone();
customCulture.NumberFormat.NumberDecimalSeparator = ".";
System.Threading.Thread.CurrentThread.CurrentCulture = customCulture;
string Boston_FileName = @"Boston.csv";
DataTable tab = new CsvReader(Boston_FileName, true).ToTable();
medv = tab.Columns["medv"].ToArray();
medv_train = medv.Get(0, 404);//80%
medv_test = medv.Get(404, 506);//20%
double[][] out_medv = medv.ToJagged();
double[][] out_medv_train = medv_train.ToJagged();
double[][] out_medv_test = medv_test.ToJagged();
tab.Columns.Remove("medv");
int signs = tab.Columns.Count;
double[][] in_x = tab.ToJagged();
double[][] in_train = in_x.Get(0, 404); //80%
double[][] in_test = in_x.Get(404, 506);//20%
to_standart( in_train, in_test);
ActivationNetwork netw = new ActivationNetwork(
new LinearFunction(),
13,
13,
1);
netw.Randomize();
var teacher = new BackPropagationLearning(netw);
for (int epoch = 0; epoch < 100; epoch++)
{
var error = teacher.RunEpoch(in_train, out_medv_train);
WriteLine($"Эпоха {epoch} ошибка {error}");
}
int count= 0, correct= 0;
for (int i = 0; i < in_test.Length; i++)
{
var prediction = netw.Compute(in_test[i]);
double outputResult = prediction.First();
WriteLine($" {outputResult}");
}
ReadLine();
I would like to expect the predicted value of the medv. It seems the linear function applies to all layers? and to the exit too? in python in keras, you can apply your own for each layer, but how in this case?
Sorry, my code is still bad, I'm just learning, this is just the beginning...