Beispiel #1
0
        public void NN_perceptron_multi_all_training_samples_gnb()
        {
            initData_dataset_gaussian_naive_bayes_jason_example();
            BuildMultiUnitPerceptronSGD build =
                new BuildMultiUnitPerceptronSGD();

            ModelMultiUnitPerceptron model =
                (ModelMultiUnitPerceptron)build.BuildModel(
                    _trainingData, _attributeHeaders,
                    _indexTargetAttribute);

            int count = 0;

            for (int row = 0; row < 10; row++)
            {
                double[] data  = GetSingleTrainingRowDataForTest(row);
                double   value = model.RunModelForSingleData(data);

                if (SupportFunctions.DoubleCompare(value,
                                                   _trainingData[_indexTargetAttribute][row]))
                {
                    count++;
                }
            }

            Assert.AreEqual(count,
                            10);
        }
Beispiel #2
0
        public void NN_perceptron_multi_single_training_sample_nb_class_1()
        {
            initData_dataset_naive_bayes_jason_example();
            BuildMultiUnitPerceptronSGD build =
                new BuildMultiUnitPerceptronSGD();

            ModelMultiUnitPerceptron model =
                (ModelMultiUnitPerceptron)build.BuildModel(
                    _trainingData, _attributeHeaders,
                    _indexTargetAttribute);
            int row = 6;

            double[] data  = GetSingleTrainingRowDataForTest(row);
            double   value = model.RunModelForSingleData(data);

            Assert.AreEqual(value,
                            _trainingData[_indexTargetAttribute][row]);
        }