metrics.accuracyScore

accuracyScore(y_true: `object`, y_pred: `object`, __namedParameters: `object`)

Accuracy classification score.

In multilabel classification, this function computes subset accuracy: the set of labels predicted for a sample must exactly match the corresponding set of labels in y_true.

Usage

import { accuracyScore } from 'machinelearn/metrics';

const accResult = accuracyScore(
 [0, 1, 2, 3],
 [0, 2, 1, 3]
);

// accuracy result: 0.5

Defined in metrics/classification.ts:93

Parameters:

ParamTypeDefaultDescription
y_truenumber[] or string[]null1d array-like, or label indicator array / sparse matrix
y_prednumber[] or string[]null1d array-like, or label indicator array / sparse matrix
options.normalizebooleantrue

Returns:

number