示例#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.");
            }
        }
示例#2
0
        private void button6_Click(object sender, EventArgs e)
        {
            BModelEvaluation dlg = new BModelEvaluation();

            double[] y1 = new double[6] {
                0, 1, 1, 0, 1, 1
            };
            double[] y2 = new double[6] {
                0.103345, 0.816285, 0.36523, 0.164645, 0.988035, 0.963756
            };

            double[] y11 = new double[] { 1, 0, 1, 1, 0, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 0, 1, 1, 0, 1, 0, 1, 1, 0, 0, 0, 0, 0, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 0, 1, 1, 0, 0, 0, 1, 0, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 1, 1, 1 };
            double[] y21 = new double[] { 0.583333, 0, 1, 0.1026, 0.058482, 0.222538, 0, 0.306647, 0.05, 0.345238, 0, 0.45, 0.137926, 0.291667, 0, 1, 0.137926, 0.055871, 0, 0, 0.46875, 0.479167, 0, 0.125, 0, 0, 0.240183, 0.270833, 0.125, 1, 0.5625, 0.1026, 1, 0.125, 0.375, 1, 0.137926, 0.240183, 0.275984, 0.5, 0.137926, 0.625, 0.5, 0.5, 0.875, 0, 0.875, 0.765625, 0.137926, 0.875, 1, 0.375, 1, 0.1026, 0.45, 0.583333, 0.351637, 1, 0.1026, 0, 0.6875, 0.25, 0, 0.625, 0, 0.1026, 0.649777, 1, 0.202232, 0, 0, 0, 0.479167, 0.375, 0.25, 1, 0.17748, 0.125, 0.5625, 0.1026, 0.75463, 0, 0, 0, 1, 0.1026, 1, 0.458333, 0.1026, 1, 0.875, 1 };

            dlg.loadClasses(new string[] { "FALSE", "TRUE" });
            dlg.loadData(y11, y21, null, null);

            dlg.ShowDialog();
        }
        private void ROCCurve_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;

            BModelEvaluation dlg = new BModelEvaluation();

            dlg.Text = $"Model performance 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();
        }