This commit is contained in:
novak_99 2022-01-21 19:17:52 -08:00
parent f9b86c2c25
commit daaabb1a7c

View File

@ -80,9 +80,9 @@ namespace MLPP{
double y_hat = Evaluate(inputSet[outputIndex]); double y_hat = Evaluate(inputSet[outputIndex]);
double z = propagate(inputSet[outputIndex]); double z = propagate(inputSet[outputIndex]);
cost_prev = Cost(std::vector<double>({z}), std::vector<double>({outputSet[outputIndex]}), weights, C); cost_prev = Cost({z}, {outputSet[outputIndex]}, weights, C);
double costDeriv = cost.HingeLossDeriv({z}, {outputSet[outputIndex]}, C)[0]; double costDeriv = cost.HingeLossDeriv(std::vector<double>({z}), std::vector<double>({outputSet[outputIndex]}), C)[0]; // Explicit conversion to avoid ambiguity with overloaded function. Error occured on Ubuntu.
// Weight Updation // Weight Updation
weights = alg.subtraction(weights, alg.scalarMultiply(learning_rate * costDeriv, inputSet[outputIndex])); weights = alg.subtraction(weights, alg.scalarMultiply(learning_rate * costDeriv, inputSet[outputIndex]));