示例#1
0
 /// <summary>
 /// Sets the input field's new data.
 /// </summary>
 /// <param name="value">The value.</param>
 public void SetNewData(double value)
 {
     _iAnalogStimuli = _featureFilter.ApplyFilter(value);
     _currentDataIdx = 0;
     _spikesEncoder.Encode(_iAnalogStimuli);
     return;
 }
示例#2
0
        /// <summary>
        /// Prepares input neurons to provide new incoming data.
        /// </summary>
        /// <param name="value">External natural input data</param>
        /// <param name="collectStatistics">Specifies whether to update internal statistics of associated input neurons</param>
        public void SetNewData(double value, bool collectStatistics)
        {
            double iStimuli = _featureFilter.ApplyFilter(value);

            //Analog neuron
            AnalogNeuron.NewStimulation(iStimuli, 0d);
            AnalogNeuron.Recompute(collectStatistics);
            //Spiking neurons
            switch (_featureFilter.Type)
            {
            case FeatureFilterBase.FeatureType.Real:
            {
                _realSpikeCode.Encode(iStimuli);
                for (int i = 0; i < SpikingNeuronCollection.Length; i++)
                {
                    SpikingNeuronCollection[i].NewStimulation(_realSpikeCode.Code[i], 0d);
                    SpikingNeuronCollection[i].Recompute(collectStatistics);
                }
            }
            break;

            case FeatureFilterBase.FeatureType.Binary:
            {
                SpikingNeuronCollection[0].NewStimulation(value, 0d);
                SpikingNeuronCollection[0].Recompute(collectStatistics);
            }
            break;

            case FeatureFilterBase.FeatureType.Enum:
            {
                int neuronIdx = ((int)Math.Round(value, 0)) - 1;
                for (int i = 0; i < SpikingNeuronCollection.Length; i++)
                {
                    double spikeVal = i == neuronIdx ? 1d : 0d;
                    SpikingNeuronCollection[i].NewStimulation(spikeVal, 0d);
                    SpikingNeuronCollection[i].Recompute(collectStatistics);
                }
            }
            break;
            }
            return;
        }