public bool IsConnection(NeuronLocation input, NeuronLocation output) { int indexInput = getNeuronIndexInNet(input); int indexOutput = getNeuronIndexInNet(output); return(learned_net.ConnectionsOfNeurons[indexOutput, indexInput]); }
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); }
public void DeleteConnection(NeuronLocation input, NeuronLocation output) { int indexIn = getNeuronIndexInNet(input); int indexOut = getNeuronIndexInNet(output); learned_net.DeleteConnection(indexIn, indexOut); }
public double GetConnectionWeight(NeuronLocation input, NeuronLocation output) { int indexInput = getNeuronIndexInNet(input); int indexOutput = getNeuronIndexInNet(output); return(learned_net.WeightsOfConnections[indexOutput, indexInput]); }
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); }
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("Связь между нейронами не найдена"); } }
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); } }
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); }
//TODO: public string GetNameOfAF(NeuronLocation neuron) { return null; }
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; }
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; }
public string[] GetNamesOfParametersAF(NeuronLocation neuron) { return null; }
public string[] GetNamesOfParametersAF(NeuronLocation neuron) { return(null); }
public void SetValueOfParameterAF(NeuronLocation neuron, string parameterName, double value) { }
public double GetDerivativeAFValue(NeuronLocation neuron, double x) { return -1; }
public bool HasAFContinuousDerivative(NeuronLocation neuron) { return(false); }
private Neuron getNeuron(NeuronLocation location) { return(learned_net.GetNeuron(getNeuronIndexInNet(location))); }
public bool IsConnection(NeuronLocation input, NeuronLocation output) { int indexInput = getNeuronIndexInNet(input); int indexOutput = getNeuronIndexInNet(output); return learned_net.ConnectionsOfNeurons[indexOutput, indexInput]; }
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; }
private Neuron getNeuron(NeuronLocation location) { return learned_net.GetNeuron(getNeuronIndexInNet(location)); }
public double GetOutputValueOfNeuron(NeuronLocation neuron) { return(getNeuron(neuron).OutputValue); }
public bool HasAFContinuousDerivative(NeuronLocation neuron) { return false; }
//TODO: public string GetNameOfAF(NeuronLocation neuron) { return(null); }
public double GetValueOfParameterAF(NeuronLocation neuron, string parameterName) { return -1; }
public int GetCountParametersAF(NeuronLocation neuron) { return(-1); }
public double GetOutputValueOfNeuron(NeuronLocation neuron) { return getNeuron(neuron).OutputValue; }
public double GetValueOfParameterAF(NeuronLocation neuron, string parameterName) { return(-1); }
public double GetDerivativeAFValue(NeuronLocation neuron, double x) { return(-1); }
public double GetAFValue(NeuronLocation neuron, double x) { return -1; }
public double GetConnectionWeight(NeuronLocation input, NeuronLocation output) { int indexInput = getNeuronIndexInNet(input); int indexOutput = getNeuronIndexInNet(output); return learned_net.WeightsOfConnections[indexOutput, indexInput]; }
public int GetCountParametersAF(NeuronLocation neuron) { return -1; }