MCPcopy Create free account
hub / github.com/arrayfire/arrayfire / accuracy

Function accuracy

examples/machine_learning/neural_network.cpp:29–34  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

27}
28
29float accuracy(const array &predicted, const array &target) {
30 array val, plabels, tlabels;
31 max(val, tlabels, target, 1);
32 max(val, plabels, predicted, 1);
33 return 100 * count<float>(plabels == tlabels) / tlabels.elements();
34}
35
36// Derivative of the activation function
37array deriv(const array &out) { return out * (1 - out); }

Callers 1

ann_demoFunction · 0.70

Calls 2

maxFunction · 0.50
elementsMethod · 0.45

Tested by

no test coverage detected