Last active
September 13, 2018 19:45
-
-
Save kidtronnix/82116c95f5b3811d491ef47c89b26a23 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package nn | |
import ( | |
"gonum.org/v1/gonum/mat" | |
) | |
func (n *MLP) Evaluate(x, y mat.Matrix) float64 { | |
p := n.Predict(x) | |
N, _ := p.Dims() | |
var correct int | |
for n := 0; n < N; n++ { | |
ry := mat.Row(nil, n, y) | |
truth = oneHotDecode(ry) | |
rp := mat.Row(nil, n, p) | |
predicted = prediction(rp) | |
if predicted == truth { | |
correct++ | |
} | |
} | |
accuracy := float64(correct) / float64(N) | |
return accuracy * 100 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment