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

Function accuracy

examples/machine_learning/deep_belief_net.cpp:21–26  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

19using std::vector;
20
21float accuracy(const array &predicted, const array &target) {
22 array val, plabels, tlabels;
23 max(val, tlabels, target, 1);
24 max(val, plabels, predicted, 1);
25 return 100 * count<float>(plabels == tlabels) / tlabels.elements();
26}
27
28// Derivative of the activation function
29array deriv(const array &out) { return out * (1 - out); }

Callers 1

dbn_demoFunction · 0.70

Calls 2

maxFunction · 0.50
elementsMethod · 0.45

Tested by

no test coverage detected