Error rate treats every mistake as equal. In practice a missed disease costs far more than a false alarm. A cost matrix states what each kind of mistake costs, and the cost-sensitive error is the average cost per sample.
Implement cost_sensitive_error(y_true, y_pred, cost_matrix), returning the mean cost over all samples.
y_true and y_pred are integer class arrays of equal length.cost_matrix[i][j] is the cost of predicting j when the truth is i; correct predictions normally cost 0.float; return 0.0 for empty input.Open one at a time. Each gives away a little more than the last.
NumPy fancy indexing looks up one cost per sample: cost_matrix[y_true, y_pred].
Average that vector.
No results yet
Run your code to check it against the examples, or submit to run every test.