Esempio n. 1
0
        public bool IsConnection(NeuronLocation input, NeuronLocation output)
        {
            int indexInput  = getNeuronIndexInNet(input);
            int indexOutput = getNeuronIndexInNet(output);

            return(learned_net.ConnectionsOfNeurons[indexOutput, indexInput]);
        }
Esempio n. 2
0
        public NeuronLocation[] GetOutputsOfNeuron(NeuronLocation neuronLocation)
        {
            int    indexCurNeuron = getNeuronIndexInNet(neuronLocation);
            Neuron neu            = getNeuron(neuronLocation);

            int k = 0;

            for (int i = 0; i < learned_net.NeuronsCount; i++)
            {
                if (learned_net.ConnectionsOfNeurons[indexCurNeuron, i] == true)
                {
                    k++;
                }
            }

            NeuronLocation[] arr = new NeuronLocation[k];
            k = 0;
            for (int i = 0; i < learned_net.NeuronsCount; i++)
            {
                if (learned_net.ConnectionsOfNeurons[indexCurNeuron, i] == true)
                {
                    arr[k] = getNeuronLocation(learned_net.GetNeuron(i));
                }
            }

            return(arr);
        }
Esempio n. 3
0
        public void DeleteConnection(NeuronLocation input, NeuronLocation output)
        {
            int indexIn  = getNeuronIndexInNet(input);
            int indexOut = getNeuronIndexInNet(output);

            learned_net.DeleteConnection(indexIn, indexOut);
        }
Esempio n. 4
0
        public double GetConnectionWeight(NeuronLocation input, NeuronLocation output)
        {
            int indexInput  = getNeuronIndexInNet(input);
            int indexOutput = getNeuronIndexInNet(output);

            return(learned_net.WeightsOfConnections[indexOutput, indexInput]);
        }
Esempio n. 5
0
        public void DeleteConnection(NeuronLocation input, NeuronLocation output)
        {
            int indexIn = getNeuronIndexInNet(input);
            int indexOut = getNeuronIndexInNet(output);

            learned_net.DeleteConnection(indexIn, indexOut);
        }
Esempio n. 6
0
 public Tuple <double, NeuronLocation>[] GetInputsOfNeuronWithWeights(NeuronLocation location)
 {
     NeuronLocation[] loc = GetInputsOfNeuron(location);
     Tuple <double, NeuronLocation>[] res = new Tuple <double, NeuronLocation> [loc.Length];
     for (int i = 0; i < loc.Length; i++)
     {
         res[i] = new Tuple <double, NeuronLocation>(GetConnectionWeight(loc[i], location), loc[i]);
     }
     return(res);
 }
Esempio n. 7
0
 public void ChangeConnectionWeight(NeuronLocation input, NeuronLocation output, double weight)
 {
     Neuron inp = getNeuron(input);
     Neuron oup = getNeuron(output);
     if (IsConnection(input, output) == true)
     {
         int indexOut = getNeuronIndexInNet(output);
         inp.SetWeightValue(weight, indexOut);
     }
     else
     {
         throw new Exception("Связь между нейронами не найдена");
     }
 }
Esempio n. 8
0
        public void ChangeConnectionWeight(NeuronLocation input, NeuronLocation output, double weight)
        {
            Neuron inp = getNeuron(input);
            Neuron oup = getNeuron(output);

            if (IsConnection(input, output) == true)
            {
                int indexOut = getNeuronIndexInNet(output);
                inp.SetWeightValue(weight, indexOut);
            }
            else
            {
                throw new Exception("Связь между нейронами не найдена");
            }
        }
Esempio n. 9
0
        public void SetNewConnection(NeuronLocation input, NeuronLocation output, double weight)
        {
            Neuron inp = getNeuron(input);
            Neuron oup = getNeuron(output);

            if (IsConnection(input, output) == true)
            {
                throw new Exception("Связь между нейронами уже существует");
            }
            else
            {
                int indexIn  = getNeuronIndexInNet(input);
                int indexOut = getNeuronIndexInNet(output);

                learned_net.SetNewConnection(indexIn, indexOut, weight);
            }
        }
Esempio n. 10
0
        private int getNeuronIndexInNet(NeuronLocation location)
        {
            if (location.Layer < 1 || location.Layer > learned_net.NeuronsInLayers.GetLength(0))
            {
                throw new Exception("Invalid index of layer");
            }

            int index = 0;

            for (int i = 0; i < location.Layer - 1; i++)
            {
                index += learned_net.NeuronsInLayers[i];
            }

            if (index + location.Number > learned_net.NeuronsCount ||
                index + location.Number < 1)
            {
                throw new Exception("Invalid number of neuron in layer");
            }

            return(index + location.Number - 1);
        }
Esempio n. 11
0
 //TODO:
 public string GetNameOfAF(NeuronLocation neuron)
 {
     return null;
 }
Esempio n. 12
0
 public Tuple<double, NeuronLocation>[] GetInputsOfNeuronWithWeights(NeuronLocation location)
 {
     NeuronLocation[] loc = GetInputsOfNeuron(location);
     Tuple<double, NeuronLocation>[] res = new Tuple<double, NeuronLocation>[loc.Length];
     for (int i = 0; i < loc.Length; i++)
     {
         res[i] = new Tuple<double, NeuronLocation>(GetConnectionWeight(loc[i], location), loc[i]);
     }
     return res;
 }
Esempio n. 13
0
        public NeuronLocation[] GetOutputsOfNeuron(NeuronLocation neuronLocation)
        {
            int indexCurNeuron = getNeuronIndexInNet(neuronLocation);
            Neuron neu = getNeuron(neuronLocation);

            int k = 0;
            for (int i = 0; i < learned_net.NeuronsCount; i++)
            {
                if (learned_net.ConnectionsOfNeurons[indexCurNeuron, i] == true)
                {
                    k++;
                }
            }

            NeuronLocation[] arr = new NeuronLocation[k];
            k = 0;
            for (int i = 0; i < learned_net.NeuronsCount; i++)
            {
                if (learned_net.ConnectionsOfNeurons[indexCurNeuron, i] == true)
                {
                    arr[k] = getNeuronLocation(learned_net.GetNeuron(i));
                }
            }

            return arr;
        }
Esempio n. 14
0
 public string[] GetNamesOfParametersAF(NeuronLocation neuron)
 {
     return null;
 }
Esempio n. 15
0
 public string[] GetNamesOfParametersAF(NeuronLocation neuron)
 {
     return(null);
 }
Esempio n. 16
0
 public void SetValueOfParameterAF(NeuronLocation neuron, string parameterName, double value)
 {
 }
Esempio n. 17
0
 public double GetDerivativeAFValue(NeuronLocation neuron, double x)
 {
     return -1;
 }
Esempio n. 18
0
 public bool HasAFContinuousDerivative(NeuronLocation neuron)
 {
     return(false);
 }
Esempio n. 19
0
 public void SetValueOfParameterAF(NeuronLocation neuron, string parameterName, double value)
 {
 }
Esempio n. 20
0
 private Neuron getNeuron(NeuronLocation location)
 {
     return(learned_net.GetNeuron(getNeuronIndexInNet(location)));
 }
Esempio n. 21
0
        public bool IsConnection(NeuronLocation input, NeuronLocation output)
        {
            int indexInput = getNeuronIndexInNet(input);
            int indexOutput = getNeuronIndexInNet(output);

            return learned_net.ConnectionsOfNeurons[indexOutput, indexInput];
        }
Esempio n. 22
0
        private int getNeuronIndexInNet(NeuronLocation location)
        {
            if (location.Layer < 1 || location.Layer > learned_net.NeuronsInLayers.GetLength(0))
                throw new Exception("Invalid index of layer");

            int index = 0;
            for (int i = 0; i < location.Layer - 1; i++)
            {
                index += learned_net.NeuronsInLayers[i];
            }

            if (index + location.Number > learned_net.NeuronsCount ||
                index + location.Number < 1)
                throw new Exception("Invalid number of neuron in layer");

            return index + location.Number - 1;
        }
Esempio n. 23
0
 private Neuron getNeuron(NeuronLocation location)
 {
     return learned_net.GetNeuron(getNeuronIndexInNet(location));
 }
Esempio n. 24
0
 public double GetOutputValueOfNeuron(NeuronLocation neuron)
 {
     return(getNeuron(neuron).OutputValue);
 }
Esempio n. 25
0
 public bool HasAFContinuousDerivative(NeuronLocation neuron)
 {
     return false;
 }
Esempio n. 26
0
 //TODO:
 public string GetNameOfAF(NeuronLocation neuron)
 {
     return(null);
 }
Esempio n. 27
0
 public double GetValueOfParameterAF(NeuronLocation neuron, string parameterName)
 {
     return -1;
 }
Esempio n. 28
0
 public int GetCountParametersAF(NeuronLocation neuron)
 {
     return(-1);
 }
Esempio n. 29
0
 public double GetOutputValueOfNeuron(NeuronLocation neuron)
 {
     return getNeuron(neuron).OutputValue;
 }
Esempio n. 30
0
 public double GetValueOfParameterAF(NeuronLocation neuron, string parameterName)
 {
     return(-1);
 }
Esempio n. 31
0
        public void SetNewConnection(NeuronLocation input, NeuronLocation output, double weight)
        {
            Neuron inp = getNeuron(input);
            Neuron oup = getNeuron(output);
            if (IsConnection(input, output) == true)
            {
                throw new Exception("Связь между нейронами уже существует");
            }
            else
            {
                int indexIn = getNeuronIndexInNet(input);
                int indexOut = getNeuronIndexInNet(output);

                learned_net.SetNewConnection(indexIn, indexOut, weight);
            }
        }
Esempio n. 32
0
 public double GetDerivativeAFValue(NeuronLocation neuron, double x)
 {
     return(-1);
 }
Esempio n. 33
0
 public double GetAFValue(NeuronLocation neuron, double x)
 {
     return -1;
 }
Esempio n. 34
0
 public double GetConnectionWeight(NeuronLocation input, NeuronLocation output)
 {
     int indexInput = getNeuronIndexInNet(input);
     int indexOutput = getNeuronIndexInNet(output);
     return learned_net.WeightsOfConnections[indexOutput, indexInput];
 }
Esempio n. 35
0
 public int GetCountParametersAF(NeuronLocation neuron)
 {
     return -1;
 }