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

Function accuracy

examples/machine_learning/perceptron.cpp:20–26  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

18using namespace af;
19
20float accuracy(const array &predicted, const array &target) {
21 array val, plabels, tlabels;
22 max(val, tlabels, target, 1);
23 max(val, plabels, predicted, 1);
24
25 return 100 * count<float>(plabels == tlabels) / tlabels.elements();
26}
27
28// Predict based on given parameters
29array predict(const array &X, const array &Weights) {

Callers 1

perceptron_demoFunction · 0.70

Calls 2

maxFunction · 0.50
elementsMethod · 0.45

Tested by

no test coverage detected