public NetPlot(NetMain xNetMain) : base(ICON.GRAPH_CLAW, "Network", SizeDialog) { //CREATE DIALOG NetMain = xNetMain; //SET BUTTON setButton("OK", "leave the dialog", new Action(() => { Close(); })); //CREATE PANEL Panel = UniPanel.Create(this); Panel.Size = SizePanel; Panel.Refresh(); //PLOT CLASSES Network = new PlotNetwork(NetMain, Panel); Neuroevolution = new PlotNeuroevolution(NetMain, Panel); //TIMER double fps = 0.1; Timer timer = new Timer(); timer.Interval = (int)(1000 / fps); timer.Tick += eventTick; timer.Start(); //EVENT LISTENER Panel.Paint += eventPaint; ResizeBegin += (s, e) => { isMoving = true; }; //RESIZE & MOVING HANDLE ResizeEnd += (s, e) => { isMoving = false; Refresh(); }; Visible = false; }
private void createPlot() { Size size = new Size(740, 400); //CREATE PLOT PanelPlot = UniPanel.Create(Dialog, BorderStyle.None, false); PanelPlot.Size = new Size(size.Width, size.Height + 30); //CHART UniChart chart = UniChart.Create(PanelPlot, 0, 0, size.Width, size.Height, BorderStyle.FixedSingle); chart.setTitles(null, null, "Performance in %"); chart.setLabelFormat(null, "0%"); chart.setStartFromZeros(false); //EVENT LISTENER PanelPlot.VisibleChanged += (s, e) => { //GET PERFORMANCE double[] perArray = new double[PerformanceList.Count]; for (int i = 0; i < perArray.Length; i++) { perArray[i] = PerformanceList[i].Performance; } //PREPARE CHART chart.SeriesRemove(); Series series = chart.SeriesLine("Performance of Network", SeriesChartType.Line, Colors.MainRecessive, 1, perArray, null); series.MarkerStyle = MarkerStyle.Circle; series.MarkerColor = Colors.MainDominant; series.MarkerSize = 4; series.MarkerBorderWidth = 1; series.MarkerBorderColor = Colors.MainRecessive; //DATA LABEL for (int i = 0; i < PerformanceList.Count; i++) { series.Points[i].Label = "LR: " + (PerformanceList[i].LearningRate * 100) + "%\nE: " + PerformanceList[i].Epochs + "\n(" + PerformanceList[i].Duration.ToString(@"mm\:ss") + ")"; } }; }
private void createSettings() { //CREATE SETTINGS PanelSettings = UniPanel.Create(Dialog, BorderStyle.None, false); PanelSettings.Size = new Size(400, 160); //LEARNING RATE decimal minimum = (decimal)NetMain.LearningRate.getMinimum() / 100; decimal maximum = (decimal)NetMain.LearningRate.getMaximum() / 100; decimal increment = (decimal)NetMain.LearningRate.TickFrequency / 1000; SpinLRnow = UniSpin.Create(PanelSettings, "Start:", "set start value of learningrate", NetMain.startposition[0], NetMain.startposition[1], minimum, maximum, increment, (decimal)LRnow); SpinLRmin = UniSpin.Create(PanelSettings, "LR (min):", "set minimal learnrate to check", Mod_Forms.nextLeft(SpinLRnow, NetMain.gap[0]), Mod_Forms.sameTop(SpinLRnow), minimum, maximum, increment, (decimal)LRmin); SpinLRmax = UniSpin.Create(PanelSettings, "LR (max):", "set maximal learnrate to check", Mod_Forms.nextLeft(SpinLRmin, NetMain.gap[0]), Mod_Forms.sameTop(SpinLRnow), minimum, maximum, increment, (decimal)LRmax); SpinLRdelta = UniSpin.Create(PanelSettings, "LR (delta):", "set delta increment per run", Mod_Forms.nextLeft(SpinLRmax, NetMain.gap[0]), Mod_Forms.sameTop(SpinLRnow), (decimal)0.001, (decimal)0.01, (decimal)0.001, (decimal)LRdelta); //EPOCHS SpinEnow = UniSpin.Create(PanelSettings, "Start:", "set start value of epoch", Mod_Forms.sameLeft(SpinLRnow), Mod_Forms.nextTop(SpinLRnow, NetMain.gap[1]), NetMain.SpinEpochs.Minimum, NetMain.SpinEpochs.Maximum, NetMain.SpinEpochs.Increment, Enow); SpinEmin = UniSpin.Create(PanelSettings, "Epoch (min):", "set minimal epoch to check", Mod_Forms.nextLeft(SpinEnow, NetMain.gap[0]), Mod_Forms.sameTop(SpinEnow), NetMain.SpinEpochs.Minimum, NetMain.SpinEpochs.Maximum, NetMain.SpinEpochs.Increment, Emin); SpinEmax = UniSpin.Create(PanelSettings, "Epoch (max):", "set maximal epoch to check", Mod_Forms.nextLeft(SpinEmin, NetMain.gap[0]), Mod_Forms.sameTop(SpinEnow), NetMain.SpinEpochs.Minimum, NetMain.SpinEpochs.Maximum, NetMain.SpinEpochs.Increment, Emax); SpinEdelta = UniSpin.Create(PanelSettings, "Epoch (delta):", "set delta increment per run", Mod_Forms.nextLeft(SpinEmax, NetMain.gap[0]), Mod_Forms.sameTop(SpinEnow), 1, 10, 1, Edelta); }