Esempio n. 1
0
            private void RecalculateNetwork(NetNeural xNet)
            {
                //RECALCULATE NETWORK
                int nodesInput  = xNet.NodesInput;
                int nodesHidden = xNet.NodesHidden;
                int nodesOutput = xNet.NodesOutput;

                //PANEL
                PanelTop    = new int[] { 0, (int)Start * 2, Panel.Height - (int)Start * 2 };
                PanelHeight = PanelTop[2] - PanelTop[1];
                PanelCenter = PanelHeight / 2 + PanelTop[1];
                PanelMax    = PanelHeight / NodesHeight;
                PanelRatio  = new float[] { nodesInput / PanelMax, nodesHidden / PanelMax, nodesOutput / PanelMax };
                for (int i = 0; i < PanelRatio.Length; i++)
                {
                    if (PanelRatio[i] < 1)
                    {
                        PanelRatio[i] = 1;
                    }
                }

                //NODES
                Count = new int[] { (int)(nodesInput / PanelRatio[0]), (int)(nodesHidden / PanelRatio[1]), (int)(nodesOutput / PanelRatio[2]) };
                float[] space = new float[] { Count[0] * NodesHeight, Count[1] * NodesHeight, Count[2] * NodesHeight };
                Area = new float[] { PanelCenter - space[0] / 2, PanelCenter - space[1] / 2, PanelCenter - space[2] / 2 };

                //TEXTS
                Caption = new string[] { "Input Nodes (" + nodesInput + ")", "Hidden Nodes (" + nodesHidden + ")", "Output Nodes (" + nodesOutput + ")" };
                Factor  = new string[] { Mod_Convert.DoubleFormat(PanelRatio[0], 2) + "x", Mod_Convert.DoubleFormat(PanelRatio[1], 2) + "x", Mod_Convert.DoubleFormat(PanelRatio[2], 2) + "x" };

                //LIST
                PointList = new List <PointF[]>();
            }
Esempio n. 2
0
        private void SimNext()
        {
            //NEXT SIMULATION
            if (NetMain.ToggleSim.Checked)
            {
                SimNew();
                NetMain.PanelProgress.AddProgress(NetMain.Worker);
            }
            else //FIND MINIMUM
            {
                NetInit?.Invoke(Net.PixelWidth, Net.PixelHeight, Net.NodesHidden, Net.NodesOutput, LRbefore, Net.Mode, false);
                Run best = new Run(null, TimeSpan.MinValue, 0, 0, 0);

                //LOOP PERFORMANCE LIST
                foreach (Run run in PerformanceList)
                {
                    if (run.Performance > best.Performance)
                    {
                        best = run;
                    }
                }

                double percent = Mod_Convert.DoubleFormat(best.Performance * 100, 2);
                NetMain.setConsoleInvoke("Simulation stoppt, best performance: " + percent + " % (LR: " + (best.LearningRate * 100) + " %, E: " + best.Epochs + ")");

                //PERFORMANCE PLOT
                ShowPlot();
            }
        }