private void ReplaceNetworksManagerControl(NetworksManager manager) { if (manager == null) { CtlNetworkName.Content = "..."; CtlMenuStart.IsEnabled = false; CtlMenuReset.IsEnabled = false; CtlMainMenuSaveAs.IsEnabled = false; CtlMenuNetwork.IsEnabled = false; CtlNetworkContextMenu.IsEnabled = false; } else { CtlNetworkName.Content = Path.GetFileNameWithoutExtension(Config.Main.GetString(Const.Param.NetworksManagerName)); CtlMenuStart.IsEnabled = true; CtlMenuReset.IsEnabled = true; CtlMainMenuSaveAs.IsEnabled = true; CtlMenuNetwork.IsEnabled = true; CtlNetworkContextMenu.IsEnabled = true; CtlPlotPresenter.Clear(); CtlStatisticsPresenter.Clear(); CtlMatrixPresenter.Clear(); } OnNetworkUIChanged(Notification.ParameterChanged.Structure); }
private void CtlTabs_SelectedIndexChanged(object sender, EventArgs e) { // newly selected network must not affect NetworksManager until it saved if (NetworksManager != null) { if (IsRunning) { lock (ApplyChangesLocker) { CtlInputDataPresenter.SetInputDataAndDraw(NetworksManager.Models.First()); CtlNetworkPresenter.RenderRunning(NetworksManager.SelectedNetworkModel); CtlPlotPresenter.Draw(NetworksManager.Models, NetworksManager.SelectedNetworkModel); CtlStatisticsPresenter.Draw(null); } } else { CtlNetworkPresenter.RenderStanding(NetworksManager.SelectedNetworkModel); } } }
private void CtlTabs_SelectionChanged(object sender, SelectionChangedEventArgs e) { // newly selected network must not affect NetworksManager until it saved if (NetworksManager != null) { if (IsRunning) { lock (ApplyChangesLocker) { CtlInputDataPresenter.SetInputDataAndDraw(NetworksManager.Models[0]); CtlNetworkPresenter.RenderRunning(NetworksManager.SelectedNetworkModel, CtlOnlyWeights.IsOn, CtlOnlyChangedWeights.IsOn, CtlHighlightChangedWeights.IsOn); CtlPlotPresenter.Draw(NetworksManager.Models, NetworksManager.SelectedNetworkModel); CtlStatisticsPresenter.Draw(NetworksManager.SelectedNetworkModel.LastStatistics); } } else { CtlNetworkPresenter.RenderStanding(NetworksManager.SelectedNetworkModel); } } }
private void DrawModels(List <NetworkDataModel> models) { var renderStart = DateTime.Now; CtlNetworkPresenter.RenderRunning(NetworksManager.SelectedNetworkModel); CtlInputDataPresenter.SetInputDataAndDraw(NetworksManager.Models.First()); foreach (var model in models) { model.DynamicStatistic.Add(model.Statistic.Percent, model.Statistic.AverageCost); } CtlPlotPresenter.Draw(models, NetworksManager.SelectedNetworkModel); var selected = NetworksManager.SelectedNetworkModel; if (selected == null) { CtlStatisticsPresenter.Draw(null); } else { var stat = new Dictionary <string, string>(); var span = DateTime.Now.Subtract(StartTime); stat.Add("Time", new DateTime(span.Ticks).ToString(@"HH\:mm\:ss")); if (selected.Statistic.Percent > 0) { var remains = new DateTime((long)(span.Ticks * 100 / selected.Statistic.Percent) - span.Ticks); stat.Add("Time remaining", new DateTime(remains.Ticks).ToString(@"HH\:mm\:ss")); } else { stat.Add("Time remaining", "N/A"); } if (selected.Statistic.LastGoodOutput > -1) { stat.Add("Last good output", $"{selected.Statistic.LastGoodInput}={selected.Statistic.LastGoodOutput} ({Converter.DoubleToText(100 * selected.Statistic.LastGoodOutputActivation, "N6")}%)"); stat.Add("Last good cost", Converter.DoubleToText(selected.Statistic.LastGoodCost, "N6")); } else { stat.Add("Last good output", "none"); stat.Add("Last good cost", "none"); } if (selected.Statistic.LastBadOutput > -1) { stat.Add("Last bad output", $"{selected.Statistic.LastBadInput}={selected.Statistic.LastBadOutput} ({Converter.DoubleToText(100 * selected.Statistic.LastBadOutputActivation, "N6")}%)"); stat.Add("Last bad cost", Converter.DoubleToText(selected.Statistic.LastBadCost, "N6")); } else { stat.Add("Last bad output", "none"); stat.Add("Last bad cost", "none"); } stat.Add("Average cost", Converter.DoubleToText(selected.Statistic.AverageCost, "N6")); stat.Add("Percent", Converter.DoubleToText(selected.Statistic.Percent, "N6") + " %"); stat.Add("Learning rate", Converter.DoubleToText(selected.LearningRate)); stat.Add("Rounds", Round.ToString()); stat.Add("Rounds/sec", ((int)((double)Round / DateTime.Now.Subtract(StartTime).TotalSeconds)).ToString()); var renderStop = DateTime.Now; stat.Add("Render time, msec", ((int)(renderStop.Subtract(renderStart).TotalMilliseconds)).ToString()); CtlStatisticsPresenter.Draw(stat); } NetworksManager.ResetModelsStatistic(); }
private Dictionary <string, string> DrawStatistics(Statistics statistics, double learningRate) { if (statistics == null) { CtlStatisticsPresenter.Draw(null); return(null); } else { var stat = new Dictionary <string, string>(20); stat.Add("Time", StartTime.Elapsed.Duration().ToString(@"hh\:mm\:ss")); if (statistics.Percent > 0) { var linerRemains = (long)((double)statistics.TotalTicksElapsed * 100 / statistics.Percent) - statistics.TotalTicksElapsed; stat.Add("Leaner time remaining", TimeSpan.FromTicks(linerRemains).ToString(@"hh\:mm\:ss")); } else { stat.Add("Time remaining", "N/A"); } if (statistics.LastGoodOutput != null) { stat.Add("Last good output", $"{statistics.LastGoodInput}={statistics.LastGoodOutput} ({Converter.DoubleToText(100 * statistics.LastGoodOutputActivation, "N4")} %)"); stat.Add("Last good cost", Converter.DoubleToText(statistics.LastGoodCost, "N6")); } else { stat.Add("Last good output", "none"); stat.Add("Last good cost", "none"); } if (statistics.LastBadOutput != null) { stat.Add("Last bad output", $"{statistics.LastBadInput}={statistics.LastBadOutput} ({Converter.DoubleToText(100 * statistics.LastBadOutputActivation, "N4")} %)"); stat.Add("Last bad cost", Converter.DoubleToText(statistics.LastBadCost, "N6")); } else { stat.Add("Last bad output", "none"); stat.Add("Last bad cost", "none"); } stat.Add("Average cost", Converter.DoubleToText(statistics.CostAvg, "N6")); stat.Add("Percent", Converter.DoubleToText(statistics.Percent, "N6") + " %"); stat.Add("Learning rate", Converter.DoubleToText(learningRate)); stat.Add("Rounds", statistics.Rounds.ToString()); double totalRoundsPerSec = statistics.Rounds / StartTime.Elapsed.Duration().TotalSeconds; //DateTime.UtcNow.Subtract(StartTime).TotalSeconds; stat.Add("Total rounds/sec", ((int)totalRoundsPerSec).ToString()); stat.Add("Total pure rounds/sec", ((int)statistics.PureRoundsPerSecond).ToString()); stat.Add(string.Empty, string.Empty); stat.Add("Render lock time, mcs", string.Empty); stat.Add("Network", ((int)TimeSpan.FromTicks(RenderTime.Network).TotalMicroseconds()).ToString()); stat.Add("Error matrix", ((int)TimeSpan.FromTicks(RenderTime.ErrorMatrix).TotalMicroseconds()).ToString()); //stat.Add("Plotter", ((int)TimeSpan.FromTicks(RenderTime.Plotter).TotalMicroseconds()).ToString()); stat.Add("Statistics", ((int)TimeSpan.FromTicks(RenderTime.Statistics).TotalMicroseconds()).ToString()); //stat.Add("Data", ((int)TimeSpan.FromTicks(RenderTime.Data).TotalMicroseconds()).ToString()); var lostRounds = (int)(statistics.PureRoundsPerSecond - totalRoundsPerSec); stat.Add("Lost rounds/sec on misc code", lostRounds.ToString()); CtlStatisticsPresenter.Draw(stat); return(stat); } }