Example #1
0
 /// <summary>
 /// Prepares input for regression stage of State Machine training.
 /// All input patterns are processed by internal reservoirs and the corresponding network predictors are recorded.
 /// </summary>
 /// <param name="patternBundle">
 /// The bundle containing known sample input patterns and desired output vectors
 /// </param>
 /// <param name="informativeCallback">
 /// Function to be called after each processed input.
 /// </param>
 /// <param name="userObject">
 /// The user object to be passed to informativeCallback.
 /// </param>
 public RegressionInput PrepareRegressionData(PatternBundle patternBundle,
                                              NeuralPreprocessor.PredictorsCollectionCallbackDelegate informativeCallback = null,
                                              Object userObject = null
                                              )
 {
     return(new RegressionInput(NP.InitializeAndPreprocessBundle(patternBundle, informativeCallback, userObject),
                                NP.CollectStatatistics(),
                                NP.NumOfNeurons,
                                NP.NumOfInternalSynapses
                                ));
 }
Example #2
0
        /// <summary>
        /// Prepares input for regression stage of State Machine training.
        /// All input vectors are processed by internal reservoirs and the corresponding network predictors are recorded.
        /// </summary>
        /// <param name="vectorBundle">
        /// The bundle containing known sample input and desired output vectors (in time order)
        /// </param>
        /// <param name="informativeCallback">
        /// Function to be called after each processed input.
        /// </param>
        /// <param name="userObject">
        /// The user object to be passed to informativeCallback.
        /// </param>
        public RegressionInput PrepareRegressionData(VectorBundle vectorBundle,
                                                     NeuralPreprocessor.PredictorsCollectionCallbackDelegate informativeCallback = null,
                                                     Object userObject = null
                                                     )
        {
            VectorBundle preprocessedData = NP.InitializeAndPreprocessBundle(vectorBundle, informativeCallback, userObject);

            InitPredictorsGeneralSwitches(preprocessedData.InputVectorCollection);
            return(new RegressionInput(preprocessedData,
                                       NP.CollectStatatistics(),
                                       NP.NumOfNeurons,
                                       NP.NumOfInternalSynapses,
                                       NumOfUnusedPredictors
                                       ));
        }
Example #3
0
        /// <summary>
        /// Performs the training of the state machine.
        /// </summary>
        /// <param name="trainingData">The training data bundle.</param>
        /// <param name="controller">The build process controller (optional).</param>
        /// <returns>The training results.</returns>
        public TrainingResults Train(VectorBundle trainingData, TNRNetBuilder.BuildControllerDelegate controller = null)
        {
            //StateMachine reset
            Reset();
            VectorBundle readoutTrainingData;

            NeuralPreprocessor.PreprocessingOverview preprocessingOverview = null;
            if (NP == null)
            {
                //Neural preprocessor is bypassed
                readoutTrainingData = trainingData;
            }
            else
            {
                //Neural preprocessing
                readoutTrainingData = NP.InitializeAndPreprocessBundle(trainingData, out preprocessingOverview);
            }
            //Training of the readout layer
            ReadoutLayer.RegressionOverview regressionOverview = RL.Build(readoutTrainingData, BuildPredictorsMapper(), controller, Config.RandomizerSeek);
            //Return the training results
            return(new TrainingResults(preprocessingOverview, regressionOverview));
        }
Example #4
0
        /// <summary>
        /// Performs training of the StateMachine
        /// </summary>
        /// <param name="vectorBundle">Training data bundle (input vectors and desired output vectors)</param>
        /// <param name="regressionController">Optional regression controller.</param>
        /// <returns>Output of the regression stage</returns>
        public TrainingResults Train(VectorBundle vectorBundle, TrainedNetworkBuilder.RegressionControllerDelegate regressionController = null)
        {
            //StateMachine reset
            Reset();
            VectorBundle readoutInput;

            NeuralPreprocessor.PreprocessingOverview preprocessingOverview = null;
            if (NP == null)
            {
                //Neural preprocessor is bypassed
                readoutInput = vectorBundle;
            }
            else
            {
                //Neural preprocessing
                readoutInput = NP.InitializeAndPreprocessBundle(vectorBundle, out preprocessingOverview);
            }
            //Training of the readout layer
            ReadoutLayer.RegressionOverview regressionOverview = RL.Build(readoutInput, BuildPredictorsMapper(), regressionController);
            //Return compact results
            return(new TrainingResults(preprocessingOverview, regressionOverview));
        }