Пример #1
0
        public void Constructor_WeightInitialization_RandomWeightCreated()
        {
            var toNeruonMock = new Mock <INeuron>();
            var connection   = new InputSynapse(toNeruonMock.Object);

            Assert.AreEqual(1, connection.Weight);
        }
Пример #2
0
        public void GetOutput_ProperlyInitialized_SameAsFromNeuronOutput()
        {
            var toNeruonMock = new Mock <INeuron>();

            var connection = new InputSynapse(toNeruonMock.Object, 1);

            Assert.AreEqual(1, connection.GetOutput());
        }
Пример #3
0
    // подключаем пирамиду к рецептивному полю колонки.
    // N - общее число битов в поле
    // r - требуемое число присоединяемых входов
    public void AttachToInputs( int N, int R, int S )
    {
        c = 1.0 / S;

          r = R;
          HashSet<int> used_inputs = new HashSet<int>();

          double R0 = 1.0 / S; // одинаковый вес афферентов по умолчанию

          afferents = new List<InputSynapse>();
          while( afferents.Count < r )
          {
           int index = (int)( Init.rnd.NextDouble() * N );
           if( !used_inputs.Contains( index ) )
           {
        used_inputs.Add( index );
        InputSynapse synapse = new InputSynapse( index, R0 );
        afferents.Add( synapse );
           }
          }

          // --- отладка
          double sumR = 0.0;
          for( int i = 0; i < afferents.Count; ++i )
           sumR += afferents[i].R;

          double X = sumR / c;
          bool is_overload = X > r;

          return;
    }
Пример #4
0
    /// <summary>
    /// Input Layer neurons just receive input values.
    /// For this they need to have connections.
    /// This function adds this kind of connection to the neuron.
    /// </summary>
    /// <param name="inputValue">
    /// Initial value that will be "pushed" as an input to connection.
    /// </param>
    public void AddInputSynapse(double inputValue)
    {
        var inputSynapse = new InputSynapse(this, inputValue);

        Inputs.Add(inputSynapse);
    }
Пример #5
0
        public void AddOutputSynapse(double?outputWeight = null)
        {
            var inputSynapse = new InputSynapse(this, outputWeight);

            Outputs.Add(inputSynapse);
        }