예제 #1
0
 /// <summary>
 /// Stores new input data to be processed.
 /// </summary>
 /// <param name="inputVector">An external input vector.</param>
 public void StoreNewData(double[] inputVector)
 {
     //Reset input data
     ResetInputProcessingQueue();
     //Store new data
     if (_encoderCfg.FeedingCfg.FeedingType == InputFeedingType.Continuous)
     {
         //Add single vector into the processing queue
         _inputDataQueue.Add(AddInternalInputs(inputVector));
     }
     else
     {
         //Split steady and varying data
         SplitSteadyAndVaryingInputData(inputVector, out _steadyData, out double[] varyingVector);
         //Check length of the external varying data vector
         ValidateExtInputVectorLength(varyingVector.Length);
         //Reset input neurons to initial state
         ResetInputNeurons(false);
         //Prepare input pattern
         FeedingPatternedSettings feedingCfg   = (FeedingPatternedSettings)_encoderCfg.FeedingCfg;
         InputPattern             inputPattern = new InputPattern(varyingVector,
                                                                  _encoderCfg.VaryingFieldsCfg.ExternalFieldsCfg.FieldCfgCollection.Count,
                                                                  feedingCfg.VarSchema,
                                                                  feedingCfg.UnificationCfg.Detrend,
                                                                  feedingCfg.UnificationCfg.UnifyAmplitude,
                                                                  feedingCfg.UnificationCfg.ResamplingCfg.SignalBeginThreshold,
                                                                  feedingCfg.UnificationCfg.ResamplingCfg.SignalEndThreshold,
                                                                  feedingCfg.UnificationCfg.ResamplingCfg.UniformTimeScale,
                                                                  NumOfTimePoints == VariableNumOfTimePoints ? ResamplingSettings.AutoTargetTimePointsNum : NumOfTimePoints
                                                                  );
         _inputDataQueue.AddRange(CompleteInputPattern(inputPattern));
     }
     return;
 }
예제 #2
0
 /// <summary>
 /// Initializes the input encoder and its feature filters from the specified samples data bundle.
 /// </summary>
 /// <param name="inputBundle">Sample input data</param>
 public void Initialize(VectorBundle inputBundle)
 {
     //Full reset
     Reset();
     if (_encoderCfg.FeedingCfg.FeedingType == InputFeedingType.Continuous)
     {
         //Continuous feeding
         //Fixed lengths
         _varyingDataVectorLength = inputBundle.InputVectorCollection[0].Length;
         NumOfTimePoints          = 1;
         //Add internal inputs and initialize feature filters
         UpdateFeatureFilters(AddInternalInputs(inputBundle.InputVectorCollection));
     }
     else
     {
         //Patterned feeding
         FeedingPatternedSettings feedingPatternedCfg = (FeedingPatternedSettings)_encoderCfg.FeedingCfg;
         //Input pattern length constraint and number of time-points
         NumOfTimePoints = feedingPatternedCfg.UnificationCfg.ResamplingCfg.TargetTimePoints != ResamplingSettings.AutoTargetTimePointsNum ? feedingPatternedCfg.UnificationCfg.ResamplingCfg.TargetTimePoints : VariableNumOfTimePoints;
         if (NumOfTimePoints == VariableNumOfTimePoints && (_routedVaryingFieldCollection.Count > 0 || feedingPatternedCfg.Slices > 1))
         {
             //because no resampling, length of external input vector must be fixed to keep consistent data
             _varyingDataVectorLength = inputBundle.InputVectorCollection[0].Length - _numOfSteadyFields;
             //Number of time-points must be also fixed
             NumOfTimePoints = _varyingDataVectorLength / _varyingFields.Count;
         }
         //Convert input vectors to InputPatterns
         foreach (double[] orgVector in inputBundle.InputVectorCollection)
         {
             //Split steady and varying data
             SplitSteadyAndVaryingInputData(orgVector, out double[] steadyVector, out double[] varyingVector);
             //Check length of the external varying data vector
             ValidateExtInputVectorLength(varyingVector.Length);
             //Convert external vector to pattern
             FeedingPatternedSettings feedingCfg   = (FeedingPatternedSettings)_encoderCfg.FeedingCfg;
             InputPattern             inputPattern = new InputPattern(varyingVector,
                                                                      _encoderCfg.VaryingFieldsCfg.ExternalFieldsCfg.FieldCfgCollection.Count,
                                                                      feedingCfg.VarSchema,
                                                                      feedingCfg.UnificationCfg.Detrend,
                                                                      feedingCfg.UnificationCfg.UnifyAmplitude,
                                                                      feedingCfg.UnificationCfg.ResamplingCfg.SignalBeginThreshold,
                                                                      feedingCfg.UnificationCfg.ResamplingCfg.SignalEndThreshold,
                                                                      feedingCfg.UnificationCfg.ResamplingCfg.UniformTimeScale,
                                                                      NumOfTimePoints == VariableNumOfTimePoints ? ResamplingSettings.AutoTargetTimePointsNum : NumOfTimePoints
                                                                      );
             List <double[]> inputPatternVectors = CompleteInputPattern(inputPattern);
             UpdateFeatureFilters(inputPatternVectors);
         }
     }
     //Number of routed input values
     NumOfRoutedValues = _routedSteadyFieldIndexCollection.Count;
     if (_routedVaryingFieldCollection.Count > 0)
     {
         NumOfRoutedValues += _routedVaryingFieldCollection.Count * NumOfTimePoints;
     }
     return;
 }
예제 #3
0
        /// <summary>
        /// Adds inputs from internal transformers and generators and converts an input pattern to series of vectors.
        /// </summary>
        /// <param name="inputPattern">An input pattern.</param>
        private List <double[]> CompleteInputPattern(InputPattern inputPattern)
        {
            //Reset transformers and generators
            ResetTransformersAndGenerators();
            //Convert pattern to completed vectors having added internal inputs from transformers and generators
            int             inputPatternTimePoints = inputPattern.VariablesDataCollection[0].Length;
            List <double[]> completedVectors       = new List <double[]>(inputPatternTimePoints);

            for (int timePointIndex = 0; timePointIndex < inputPatternTimePoints; timePointIndex++)
            {
                double[] externalInputVector = inputPattern.GetDataAtTimePoint(timePointIndex);
                double[] completedVector     = AddInternalInputs(externalInputVector);
                completedVectors.Add(completedVector);
            }
            return(completedVectors);
        }
예제 #4
0
        private void button1_Click(object sender, EventArgs e)
        {
            float[] input = new float[4];
            input[0] = -100.0F;
            input[1] = -40.0F;
            input[2] = -90.0F;
            input[3] = -66.0F;

            InputPattern i = new InputPattern(input);

            LVQ.NET.LVQExe exe = new LVQExe();
            exe.loadLVQNet(@"D:\netConfig\LocationAwareSchedular\309\LVQ_4_8_3_LocationAwareSchedular.LVQ");
            OutputPattern o = exe.feedInput(i);

            MessageBox.Show((o.getOutputPattern()[0] + " " + o.getOutputPattern()[1] + " " + o.getOutputPattern()[2]));
        }
 public string GetTargetName(string archiveFilePath)
 {
     return(InputPattern.Replace(archiveFilePath, OutputPattern));
 }
예제 #6
0
 private void ButtonBase_OnClick(object sender, RoutedEventArgs args)
 {
     InputPattern.Clear();
 }