Пример #1
0
        public void Setup()
        {
            algorithm = new BSWTrainingAlgorithm();

            var trainedModel = algorithm.Train(TestEntities.GetTrainingSamples());

            bswNeuralNetwork = new BSWNeuralNetwork(trainedModel);
        }
Пример #2
0
        private void loadModelButton_Click(object sender, EventArgs e)
        {
            OpenFileDialog fileDialog = new OpenFileDialog();

            fileDialog.Filter = "Json|*.json";
            if (fileDialog.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            initialTrainingSamples    = Persistence.ReadTrainingSamplesFromFile(fileDialog.FileName);
            additionalTrainingSamples = new List <Sample>();

            bswTrainingAlgorithm = new BSWTrainingAlgorithm();
            var initialModel = bswTrainingAlgorithm.Train(initialTrainingSamples);

            bswNeuralNetwork = new BSWNeuralNetwork(initialModel);
        }
Пример #3
0
        private void InitializedBSW()
        {
            try
            {
                initialTrainingSamples = Persistence.ReadTrainingSamplesFromFile("SavedTrainingSamples\\initialTrainingSamples.json");

                bswTrainingAlgorithm = new BSWTrainingAlgorithm();
                var initialModel = bswTrainingAlgorithm.Train(initialTrainingSamples);

                bswNeuralNetwork = new BSWNeuralNetwork(initialModel);

                ShowBSWHiddenLayerNodes();
            }
            catch (Exception)
            {
                initialTrainingSamples = new List <Sample>();
            }

            additionalTrainingSamples = new List <Sample>();
        }
Пример #4
0
        private void TrainCurrentShape(ShapeType shapeType)
        {
            if (!strokes.Any())
            {
                return;
            }

            var trainingSample = Preprocessing.GetTrainingSampleFromShapeFeatures(currentShapeFeatures, shapeType);

            additionalTrainingSamples.Add(trainingSample);

            var allTrainingSamples = initialTrainingSamples.Concat(additionalTrainingSamples).ToList();

            try
            {
                bswTrainingAlgorithm = new BSWTrainingAlgorithm();
                var trainedModel = bswTrainingAlgorithm.Train(allTrainingSamples);
                bswNeuralNetwork = new BSWNeuralNetwork(trainedModel);
            }
            catch (Exception e) { }

            ShowBSWHiddenLayerNodes();
        }