public override void Run()
        {
            for (int i = 0; i < 2; i++)
            {

                List<string> catalogue = GenericFactory<PatternRecognizer>.Instance.SupportedProducts;

                foreach (string item in catalogue)
                {
                    _patternRecognizer = GenericFactory<PatternRecognizer>.Instance.CreateProduct(item);
                    Console.Out.WriteLine(item);

                }
            }
        }
        public override void Run()
        {
            List<string> itemList = GenericFactory<PatternRecognizer>.Instance.SupportedProducts;

            foreach (string item in itemList)
                InstanceManager<PatternRecognizer>.Instance.Register(GenericFactory<PatternRecognizer>.Instance.CreateProduct(item));

            //And one more time to check what happens when overwriting :)

            foreach (string item in itemList)
                InstanceManager<PatternRecognizer>.Instance.Register(GenericFactory<PatternRecognizer>.Instance.CreateProduct(item));

            List<string> instances = InstanceManager<PatternRecognizer>.Instance.RegisteredInstances;

            _patternRecognizer = InstanceManager<PatternRecognizer>.Instance.Retrieve("LDA");
        }
        public override void Run()
        {
            double[] itemToClassify = new double[2] {2.81,5.46};
            double[] result = new double[27];

            _trainingPackage = MakeTrainingPackage();

            //Now we inintialize and train the LDAPatternRecognizer.
            //Input dimension is 2 because we have 2 features per feature vector. Output dimension is 27 because
            //on the final application there will be 27 possible movements including rest (movement 0)
            _patternRecognizer = GenericFactory<PatternRecognizer>.Instance.CreateProduct("LDA");//new LDAPatternRecognizer(_trainingPackage, 2, 27);

            //_patternRecognizer.inputDim = 2;
            //_patternRecognizer.outputDim = 27;
            _patternRecognizer.trainingPackage = _trainingPackage;

            _patternRecognizer.activationFunctionIdx = 0;
            _patternRecognizer.normalizerIdx = 0;

            _patternRecognizer.RunTraining();

            result = (double[])_patternRecognizer.Classify(itemToClassify);
        }
Esempio n. 4
0
        void ReaModel_PropertyChanged(object sender, PropertyChangedEventArgs e)
        {
            switch (e.PropertyName)
            {

                case "thresholdRecordingConfig":
                    if (thresholdRecordingConfig != null)
                    {
                        LoadThesholdControls();
                    }
                    break;

                case "patternRecognizer":
                    if (!levelControlled)
                    {
                        if (_patternRecognizer != null)
                            recordingConfig = _patternRecognizer.trainingPackage.recordingConfig;
                        else _patternRecognizer = null;
                        this.NotifyPropertyChanged("multipleActivationSupported");
                    }
                    break;

                case "levelControlled":
                    if (levelControlled)
                    {
                        recordingConfig = thresholdRecordingConfig;
                    }
                    else if (_patternRecognizer != null)
                    {
                        recordingConfig = _patternRecognizer.trainingPackage.recordingConfig;
                    }
                    else recordingConfig = null;

                    if (_movementGenerator != null) _movementGenerator.levelControlled = levelControlled;
                    break;

                case "multipleActivation":

                    if (_movementGenerator != null)
                        _movementGenerator.multipleActivation = multipleActivation;

                    break;
                default:
                    break;
            }
        }