コード例 #1
0
 public void OnAlgorithmEnded(IEnumerable<ActivationNeuron> neurons, ConfusionMatrix matrix)
 {
     var handler = Finished;
     if (handler != null)
     {
         var e = new AlgorithmFinishedEventArgs()
         {
             Neurons = neurons,
             Matrix = matrix
         };
         handler(this, e);
     }
 }
コード例 #2
0
        public void OnAlgorithmEnded(IEnumerable <ActivationNeuron> neurons, ConfusionMatrix matrix)
        {
            var handler = Finished;

            if (handler != null)
            {
                var e = new AlgorithmFinishedEventArgs()
                {
                    Neurons = neurons,
                    Matrix  = matrix
                };
                handler(this, e);
            }
        }
コード例 #3
0
ファイル: Conductor.cs プロジェクト: salufa/MachineLearning
        private void neuralNetwork_Finished(object sender, AlgorithmFinishedEventArgs e)
        {
            var classifiers = new List<Double[,]>();
            foreach (var neuron in e.Neurons)
            {
                double k = (neuron.Weights[1] != 0) ? (-neuron.Weights[0] / neuron.Weights[1]) : 0;
                double b = (neuron.Weights[1] != 0) ? (-((ActivationNeuron)neuron).Threshold / neuron.Weights[1]) : 0;
                double[,] classifier = new double[2, 2] 
                {
                    { (float)m_minX, (float)m_minX * k + b },
                    { (float)m_maxX, (float)m_maxX * k + b }
                };
                classifiers.Add(classifier);
            }

            var bestCM = e.Matrix;

            if (MostAccurateNN == null || bestCM.Accuracy > MostAccurateNN.Item2.Accuracy)
                MostAccurateNN = Tuple.Create(classifiers, bestCM);

            m_view.ChartUpdate("nnChart", "classifier1", MostAccurateNN.Item1);
        }
コード例 #4
0
ファイル: Conductor.cs プロジェクト: salufa/MachineLearning
        private void perceptron_Finished(object sender, AlgorithmFinishedEventArgs e)
        {
            var neuron = e.Neurons.First();
            // Calculate the coordinates of the classifier
            double k = (neuron.Weights[1] != 0) ? (-neuron.Weights[0] / neuron.Weights[1]) : 0;
            double b = (neuron.Weights[1] != 0) ? (-((ActivationNeuron)neuron).Threshold / neuron.Weights[1]) : 0;

            // Create the line and feed it to the data series
            double[,] classifier = new double[2, 2]
            {
               { (float)m_minX, (float)m_minX * k + b },
               { (float)m_maxX, (float)m_maxX * k + b }
            };

            var cmatrix = e.Matrix;
            //Update the most accurate classification
            if (MostAccuratePerceptron == null || cmatrix.Accuracy > MostAccuratePerceptron.Item2.Accuracy)
            {
                MostAccuratePerceptron = Tuple.Create(classifier, cmatrix);
            }

            m_view.ChartUpdate("perceChart", "classifier", MostAccuratePerceptron.Item1);
        }