Ejemplo n.º 1
0
        private void btnmodelEvaluation_Click(object sender, System.EventArgs e)
        {
            var ret = EvaluateResults();

            if (EvaluateResults != null && ret != null)
            {
                //
                if (Parameters.OutputType == BasicTypes.ColumnType.Numeric)
                {
                    RModelEvaluation dlg = new RModelEvaluation();
                    dlg.Evaluate(ret["obs_train"].Select(x => (double)x).ToArray(), ret["prd_train"].Select(x => (double)x).ToArray(),
                                 ret.ContainsKey("obs_test") ? ret["obs_test"].Select(x => (double)x).ToArray() : null,
                                 ret.ContainsKey("prd_test") ? ret["prd_test"].Select(x => (double)x).ToArray() : null);

                    dlg.ShowDialog();
                }
                else if (Parameters.OutputType == BasicTypes.ColumnType.Binary || (ret.ContainsKey("Classes") && ret["Classes"].Count() == 2))
                {
                    BModelEvaluation dlg = new BModelEvaluation();
                    var cl = ret["Classes"].Select(x => x.ToString()).ToArray();
                    dlg.loadClasses(cl);
                    dlg.loadData(ret["obs_train"].Select(x => (double)x).ToArray(), ret["prd_train"].Select(x => (double)x).ToArray(),
                                 ret.ContainsKey("obs_test") ? ret["obs_test"].Select(x => (double)x).ToArray() : null,
                                 ret.ContainsKey("prd_test") ? ret["prd_test"].Select(x => (double)x).ToArray() : null);

                    dlg.ShowDialog();
                }
                else
                {
                    MModelEvaluation dlg = new MModelEvaluation();
                    var cl = ret["Classes"].Select(x => x.ToString()).ToArray();
                    dlg.loadClasses(cl);
                    dlg.loadData(ret["obs_train"].Select(x => (double)x).ToArray(), ret["prd_train"].Select(x => (double)x).ToArray(),
                                 ret.ContainsKey("obs_test") ? ret["obs_test"].Select(x => (double)x).ToArray() : null,
                                 ret.ContainsKey("prd_test") ? ret["prd_test"].Select(x => (double)x).ToArray() : null);

                    dlg.ShowDialog();
                }
            }
            else
            {
                MessageBox.Show("Evaluation process is not initialized.");
            }
        }
Ejemplo n.º 2
0
        private void CMatric_Click(object sender, RoutedEventArgs e)
        {
            if (!(this.DataContext is Models.ModelPerformance))
            {
                return;
            }

            var modelPerf = (Models.ModelPerformance) this.DataContext;
            var ret       = ((Models.ModelPerformance) this.DataContext).PerformanceData;

            MModelEvaluation dlg = new MModelEvaluation();

            dlg.Text = $"Confusion matrix for {modelPerf.DatSetName}";
            var cl = ret["Classes"].Select(x => x.ToString()).ToArray();

            dlg.loadClasses(cl);
            dlg.loadData(ret["obs_train"].Select(x => (double)x).ToArray(), ret["prd_train"].Select(x => (double)x).ToArray(),
                         null, null);

            dlg.ShowDialog();
        }
Ejemplo n.º 3
0
        private void CMatric_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (!(this.DataContext is Models.ModelPerformance))
                {
                    return;
                }

                var modelPerf = (Models.ModelPerformance) this.DataContext;
                var ret       = ((Models.ModelPerformance) this.DataContext).PerformanceData;

                //no validation or
                if (ret == null)
                {
                    throw new Exception("The dataset is empty!");
                }

                MModelEvaluation dlg = new MModelEvaluation();
                dlg.Text = $"Confusion matrix for {modelPerf.DatSetName}.";
                var cl = ret["Classes"].Select(x => x.ToString()).ToArray();
                dlg.loadClasses(cl);
                dlg.loadData(ret["obs_train"].Select(x => (double)x).ToArray(), ret["prd_train"].Select(x => (double)x).ToArray(),
                             null, null);

                dlg.ShowDialog();
            }
            catch (Exception ex)
            {
                var ac = App.Current.MainWindow.DataContext as AppController;
                if (ac != null)
                {
                    ac.ReportException(ex);
                }
            }
        }
Ejemplo n.º 4
0
        private void button7_Click(object sender, EventArgs e)
        {
            MModelEvaluation dlg = new MModelEvaluation();

            double[] y1 = new double[13] {
                0, 1, 2, 1, 2, 0, 1, 0, 2, 2, 2, 0, 2
            };
            double[] y2 = new double[13] {
                1, 2, 0, 1, 2, 0, 1, 0, 2, 1, 2, 0, 2
            };

            double[] y11 = new double[60] {
                0, 0, 1, 1, 0, 2, 1, 0, 2, 1, 0, 0, 1, 0, 0, 1, 0, 0, 2, 2, 1, 1, 0, 1, 2, 2, 1, 1, 0, 0, 1, 1, 2, 1, 0, 1, 2, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 2, 0, 2, 0, 2, 2, 0, 2, 2, 0, 2, 2
            };
            double[] y21 = new double[60] {
                0, 0, 1, 1, 0, 2, 1, 0, 2, 1, 0, 0, 1, 0, 0, 1, 0, 0, 2, 2, 1, 1, 0, 1, 2, 2, 1, 1, 0, 0, 2, 1, 2, 1, 0, 1, 2, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 2, 0, 2, 0, 2, 2, 0, 2, 2, 0, 2, 2
            };


            dlg.loadClasses(new string[] { "C1", "C2", "C3" });
            dlg.loadData(y1, y2, null, null);

            dlg.ShowDialog();
        }