I have an internal project (separated folder) in my MVC App. It contains classes of one of my projects. Then I have one controller for this project and method that initializes it looks like this :
[HttpPost]
public ActionResult initiate() {
// System.Diagnostics.Debug.WriteLine("Initiated");
Network net = new Network(normalizeInput);
net.train();
// System.Diagnostics.Debug.WriteLine("average error :" + net.averageError);
double err = net.averageError;
ViewBag.err = err.ToString();
return View("initiate");
}
and its view :
@{
ViewBag.Title = "initiate";
}
<h3>Everything is prepared</h3>
<!--<button type="button" onclick="location.href='@Url.Action("initiate", "BackpropController")'"/> -->
@using (Html.BeginForm("initiate", "Backprop", FormMethod.Post)) {
@Html.AntiForgeryToken()
<input type="submit" value="Initiate" />
}
<br>
<br>
@{ string averageError = ViewBag.err;
if (averageError != null) {
<h4>@averageError</h4> }
else { <h4>no error</h4>}
}
The question is : How can I show in the view updated value by each iteration?
Because that variable is final one, but method train()
contains loop where average error is like this :
averageError += Math.Abs(testingSet[j].desiredOutput - neuron.getOutput());
It interests me because I would like to make graph of error as it would be function of iteration.. simply said :
f(error,iteration)
The graph should be placed in the view I posted and should be updated every iteration situated in method train()
Thanks for the answers.