示例#1
0
        private ClassifierFacade RunTrainingForSelectedCategoriesImpl(TrainingParameters trainingParameters)
        {
            var categories  = trainingParameters.SelectedCategories.ToArray();
            var learningSet = _dataProvider.GetLearningSetForCategories(categories);

            var layers          = _globalTrainerConfiguration.HiddenLayers.ToList();
            int outputLayerSize = categories.Length;

            layers.Add(outputLayerSize);

            var trainer = new Trainer(new TrainerConfiguration
            {
                Layers            = layers.ToArray(),
                InputsOutputsData = learningSet.TrainingData.ToInputOutputsDataNative(),
            }, _skipPhaseRequest, _guiLogger);

            trainer.RunTraining1(trainingParameters.Training1Parameters);
            trainer.RunTraining2(trainingParameters.Training2Parameters);

            trainer.CheckAccuracy(learningSet.TestData.ToInputOutputsDataNative());

            var classifierConfiguration = new ClassifierConfiguration {
                Categories = categories
            };
            var classifier = new Classifier(trainer.NeuralNetwork, classifierConfiguration, _guiLogger);

            var classifierFacade = new ClassifierFacade(_dataProvider, classifier);

            return(classifierFacade);
        }