Once we click the Run button, we will execute the function outlined as follows. We first determine the number of iterations the user wants to use, as well as the batch size. After setting up our progress bar and some internal variables, we call our TrainNetwork() function:
private void btnStart_Click(object sender, EventArgs e)
{
int iteration = int.Parse(textBox1.Text);
batchSize = int.Parse(textBox2.Text);
progressBar1.Maximum = iteration;
progressBar1.Value = 1;
inDim = 5;
ouDim = 1;
int hiDim = 1;
int cellDim = inDim;
Task.Run(() => TrainNetwork(DataSet, hiDim, cellDim, iteration, batchSize, ReportProgress));
}