Beispiel #1
0
        public static void Run(LearningArguments _arguments)
        {
            arguments = _arguments;
            baseMaker = _arguments.BaseMaker;
            baseMaker.Generate();

            table = new UserControl
            {
                Dock= DockStyle.Left,
                Size=new Size(400,400)
            };

            success = new HistoryChart
            {
                Lines = {
                    new HistoryChartValueLine
                    {

                    DataFunction = { Color = Color.Blue },
                    }
                },
                Dock = DockStyle.Right,
                Size = new Size(400, 400)
            };

            form = new Form()
            {
                Text = "Symbols recognition",
                ClientSize=new Size(800,400),
                Controls=
                {
                    table,
                    success
                }
            };
            new Action(Learn).BeginInvoke(null, null);
            Application.Run(form);
        }
Beispiel #2
0
        static void Main()
        {
            Weights=Enumerable.Range(0,Count).Select(z=>rnd.Next(MaxWeight)).ToArray();
            if (Weights.Sum() % 2 != 0) Weights[0]++;

            form = new Form();
            var table = new TableLayoutPanel() { Dock = DockStyle.Fill, RowCount = 2, ColumnCount = 1 };

            valuationsChart = new HistoryChart
            {
                Lines =
                {
                    new HistoryChartValueLine { DataFunction = { Color = Color.Green, BorderWidth=2 }},
                    new HistoryChartValueLine { DataFunction = { Color = Color.Orange, BorderWidth=2 }},
                },
                Max = 1,
                Dock = DockStyle.Fill
            };
            agesChart = new HistoryChart
            {
                Lines = { new HistoryChartValueLine { DataFunction = { Color = Color.Blue, BorderWidth=2 } } },
                Dock = DockStyle.Fill,
                Max=100
            };

            table.Controls.Add(valuationsChart,0,0);
            table.Controls.Add(agesChart,0,1);

            for (int i = 0; i < 2; i++)
            {
                table.RowStyles.Add(new RowStyle { SizeType = SizeType.Percent, Height = 50 });
            }

            form.Controls.Add(table);
            form.WindowState = FormWindowState.Maximized;

            new Thread(Algorithm) { IsBackground = true }.Start();
            Application.Run(form);
        }
Beispiel #3
0
        static void Main()
        {
            task.Prepare();

            var targetFunction = new Series()
            {
                ChartType = SeriesChartType.Line,
                Color = Color.Red,
                BorderWidth = 2
            };
            for (int i = 0; i < task.Inputs.Length; i++)
                targetFunction.Points.Add(new DataPoint(task.Inputs[i][0], task.Answers[i][0]));

            computedFunction = new Series()
            {
                ChartType = SeriesChartType.Line,
                Color = Color.Green,
                BorderWidth = 2
            };

            history = new HistoryChart
                    {
                        Max = task.MaxError,
                        DotsCount=200,
                        Lines =
                        {
                            new HistoryChartValueLine
                            {
                                DataFunction = { Color = Color.Blue }
                            }
                        },
                        Dock = DockStyle.Bottom
                    };

            form = new Form()
            {
                Text = task.GetType().Name,
                Size = new Size(800, 600),
                FormBorderStyle = FormBorderStyle.FixedDialog,
                Controls =
                {
                    new Chart
                    {
                        ChartAreas =
                        {
                            new ChartArea
                            {
                                AxisX=
                                {
                                    Minimum = task.Inputs.Min(z=>z[0]),
                                    Maximum = task.Inputs.Max(z=>z[0])
                                },
                                AxisY=
                                {
                                    Minimum = Math.Min(-1.5,task.Answers.Min(z=>z[0])),
                                    Maximum = Math.Max(1.5, task.Answers.Max(z=>z[0]))
                                }
                            }
                        },
                        Series = { targetFunction, computedFunction },
                        Dock= DockStyle.Top
                    },
                    history
                }
            };

            task.UpdateCharts += (s, a) => form.BeginInvoke(new Action(UpdateCharts));
            new Action(task.Learn).BeginInvoke(null, null);
            Application.Run(form);
        }
Beispiel #4
0
        protected virtual void PrepareCharts()
        {
            var learningPoints = new Series()
            {
                ChartType = SeriesChartType.Point,
                Color = Color.Red,
                MarkerSize = 10
            };
            for (int i = 0; i < LearningInputs.Length; i++)
                learningPoints.Points.Add(new DataPoint(LearningInputs[i][0], LearningAnswers[i][0]));

            computedFunction = new Series() { MarkerSize = 10, Color = Color.Green, ChartType = SeriesChartType.Point };

            AreaChart = new Chart
            {
                ChartAreas = { new ChartArea()
                        {
                            AxisY = {Maximum=1, Minimum=-1 }
                        }},
                Series = { learningPoints, computedFunction },
                Dock = DockStyle.Top
            };

            HistoryChart = new HistoryChart
            {
                Lines =
                {
                    new HistoryChartValueLine { DataFunction = { Color = Color.Blue }},
                },
                Dock = DockStyle.Bottom,
                Max=MaxError

            };
        }