public override int GetHashCode() { int hash = 1; if (Engine.Length != 0) { hash ^= Engine.GetHashCode(); } if (Normalization.Length != 0) { hash ^= Normalization.GetHashCode(); } if (NInput != 0) { hash ^= NInput.GetHashCode(); } if (NOutput != 0) { hash ^= NOutput.GetHashCode(); } if (LearningRate != 0D) { hash ^= LearningRate.GetHashCode(); } if (BatchSize != 0) { hash ^= BatchSize.GetHashCode(); } if (EpochSize != 0) { hash ^= EpochSize.GetHashCode(); } if (Optimizer.Length != 0) { hash ^= Optimizer.GetHashCode(); } if (LossFunc.Length != 0) { hash ^= LossFunc.GetHashCode(); } hash ^= maxV_.GetHashCode(); hash ^= minV_.GetHashCode(); hash ^= meanV_.GetHashCode(); hash ^= stdV_.GetHashCode(); hash ^= layers_.GetHashCode(); return(hash); }
internal static float GetTotalLoss(float[][] outputSignals, float[][] expectedSignals, LossFunc lossFunc) { float _totalLoss = 0; switch (lossFunc) { case LossFunc.MSE: for (int _sample = 0; _sample < outputSignals.Length; _sample++) { for (int _neuron = 0; _neuron < outputSignals[0].Length; _neuron++) { _totalLoss += (float)Math.Pow(expectedSignals[_sample][_neuron] - outputSignals[_sample][_neuron], 2); } } _totalLoss = _totalLoss / outputSignals.Length; break; case LossFunc.RootMSE: _totalLoss = (float)Math.Sqrt(GetTotalLoss(outputSignals, expectedSignals, LossFunc.MSE)); break; case LossFunc.Arctan: for (int _sample = 0; _sample < outputSignals.Length; _sample++) { for (int _neuron = 0; _neuron < outputSignals[0].Length; _neuron++) { _totalLoss += (float)Math.Pow(Math.Atan(expectedSignals[_sample][_neuron] - outputSignals[_sample][_neuron]), 2); } } _totalLoss = _totalLoss / outputSignals.Length; break; } return(_totalLoss); }
public Builder SetLossFunc(LossFunc lossFunc) { LossFunc = lossFunc; return(this); }