예제 #1
0
        public bool IsConnection(NeuronLocation input, NeuronLocation output)
        {
            int indexInput  = getNeuronIndexInNet(input);
            int indexOutput = getNeuronIndexInNet(output);

            return(learned_net.ConnectionsOfNeurons[indexOutput, indexInput]);
        }
예제 #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);
        }
예제 #3
0
        public void DeleteConnection(NeuronLocation input, NeuronLocation output)
        {
            int indexIn  = getNeuronIndexInNet(input);
            int indexOut = getNeuronIndexInNet(output);

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

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

            learned_net.DeleteConnection(indexIn, indexOut);
        }
예제 #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);
 }
예제 #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("Связь между нейронами не найдена");
     }
 }
예제 #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("Связь между нейронами не найдена");
            }
        }
예제 #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);
            }
        }
예제 #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);
        }
예제 #11
0
 //TODO:
 public string GetNameOfAF(NeuronLocation neuron)
 {
     return null;
 }
예제 #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;
 }
예제 #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;
        }
예제 #14
0
 public string[] GetNamesOfParametersAF(NeuronLocation neuron)
 {
     return null;
 }
예제 #15
0
 public string[] GetNamesOfParametersAF(NeuronLocation neuron)
 {
     return(null);
 }
예제 #16
0
 public void SetValueOfParameterAF(NeuronLocation neuron, string parameterName, double value)
 {
 }
예제 #17
0
 public double GetDerivativeAFValue(NeuronLocation neuron, double x)
 {
     return -1;
 }
예제 #18
0
 public bool HasAFContinuousDerivative(NeuronLocation neuron)
 {
     return(false);
 }
예제 #19
0
 public void SetValueOfParameterAF(NeuronLocation neuron, string parameterName, double value)
 {
 }
예제 #20
0
 private Neuron getNeuron(NeuronLocation location)
 {
     return(learned_net.GetNeuron(getNeuronIndexInNet(location)));
 }
예제 #21
0
        public bool IsConnection(NeuronLocation input, NeuronLocation output)
        {
            int indexInput = getNeuronIndexInNet(input);
            int indexOutput = getNeuronIndexInNet(output);

            return learned_net.ConnectionsOfNeurons[indexOutput, indexInput];
        }
예제 #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;
        }
예제 #23
0
 private Neuron getNeuron(NeuronLocation location)
 {
     return learned_net.GetNeuron(getNeuronIndexInNet(location));
 }
예제 #24
0
 public double GetOutputValueOfNeuron(NeuronLocation neuron)
 {
     return(getNeuron(neuron).OutputValue);
 }
예제 #25
0
 public bool HasAFContinuousDerivative(NeuronLocation neuron)
 {
     return false;
 }
예제 #26
0
 //TODO:
 public string GetNameOfAF(NeuronLocation neuron)
 {
     return(null);
 }
예제 #27
0
 public double GetValueOfParameterAF(NeuronLocation neuron, string parameterName)
 {
     return -1;
 }
예제 #28
0
 public int GetCountParametersAF(NeuronLocation neuron)
 {
     return(-1);
 }
예제 #29
0
 public double GetOutputValueOfNeuron(NeuronLocation neuron)
 {
     return getNeuron(neuron).OutputValue;
 }
예제 #30
0
 public double GetValueOfParameterAF(NeuronLocation neuron, string parameterName)
 {
     return(-1);
 }
예제 #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);
            }
        }
예제 #32
0
 public double GetDerivativeAFValue(NeuronLocation neuron, double x)
 {
     return(-1);
 }
예제 #33
0
 public double GetAFValue(NeuronLocation neuron, double x)
 {
     return -1;
 }
예제 #34
0
 public double GetConnectionWeight(NeuronLocation input, NeuronLocation output)
 {
     int indexInput = getNeuronIndexInNet(input);
     int indexOutput = getNeuronIndexInNet(output);
     return learned_net.WeightsOfConnections[indexOutput, indexInput];
 }
예제 #35
0
 public int GetCountParametersAF(NeuronLocation neuron)
 {
     return -1;
 }