Beispiel #1
0
        private void buttonRunCase_Click(object sender, EventArgs e)
        {
            if (network.IsTrained && dataSet.GetType() == typeof(IrisFlowerDataSets))
            {
                Cursor.Current = Cursors.WaitCursor;
                var caseSet = new DataSet[1];
                caseSet[0] = new IrisFlower(Convert.ToDouble(textBoxSL.Text), Convert.ToDouble(textBoxSW.Text), Convert.ToDouble(textBoxPL.Text), Convert.ToDouble(textBoxPW.Text), IrisFlower.IrisSpecies.Unknown);
                textBoxResult.Clear();

                Matrix <double> runCaseInput = dataSet.CreatePropertiesMatrixFromSet(caseSet);
                Matrix <double> predicted    = network.Forward(runCaseInput);

                textBoxResult.AppendText(DataSet.ClassifyOutput(predicted.Column(0), NetworkGraphics.OutputNames, caseSet[0]));

                NetworkGraphics.ToTreeView(treeView1, network);
                NetworkGraphics.ToPictureBox(pictureBox1, network, 400, 0);
                Cursor.Current = Cursors.Default;
            }
        }
Beispiel #2
0
        //OVERRIDES DEFAULTA RESULT PROCESSING
        public override String ProcessTestSetResults(Matrix <double> testSetInput, Matrix <double> testSetOutput, Matrix <double> testSetPredictedOutcome)
        {
            double accError     = 0;
            int    failures     = 0;
            int    canNotDefine = 0;
            String txt          = "Testing Set Results\r\n\r\n";

            for (int i = 0; i < testSetPredictedOutcome.RowCount; i++)
            {
                var realResult      = IrisFlower.EstimateSpecie(testSetOutput.Row(i).ToArray());
                var estimatedResult = IrisFlower.EstimateSpecie(testSetPredictedOutcome.Row(i).ToArray());
                var error           = EstimationItemError(testSetPredictedOutcome.Row(i));

                string result = String.Empty;

                if (estimatedResult == IrisFlower.IrisSpecies.Unknown)
                {
                    canNotDefine++;
                    result = "[UNDEFINED]";
                }
                else
                {
                    if (estimatedResult != realResult)
                    {
                        failures++;
                        result = "[ERROR]";
                    }
                }

                result   += "Real Output was " + realResult.ToString() + " estimation was " + estimatedResult.ToString() + "[Error:" + Math.Round(error, 5) + "]\r\n";
                txt      += result;
                accError += error;
            }

            txt += "\r\n\r\nAverage Estimation Error: " + (accError / testSetPredictedOutcome.RowCount).ToString();
            txt += "\r\nTotal Errors: " + failures + " out of " + testSetPredictedOutcome.RowCount + " samples [" + Math.Round((double)(100 * failures / testSetPredictedOutcome.RowCount), 2) + "%]";
            txt += "\r\nTotal Undefined: " + canNotDefine + " out of " + testSetPredictedOutcome.RowCount + " samples [" + Math.Round((double)(100 * canNotDefine / testSetPredictedOutcome.RowCount), 2) + "%]";

            return(txt);
        }
Beispiel #3
0
        new const double defaultErrorThreshold = 0.25; //Override BaseClass DefaultErrorThreshold

        public IrisFlowerDataSets()
        {
            InputNeuronNames  = IrisFlower.GetInputVariablesList();
            OutputNeuronNames = IrisFlower.GetOutputVariablesList();
        }