MCPcopy Create free account
hub / github.com/dmlc/xgboost / check_pred

Function check_pred

tests/python/test_with_sklearn.py:55–64  ·  view source on GitHub ↗
(preds, labels, output_margin)

Source from the content-addressed store, hash-verified

53 from sklearn.model_selection import KFold
54
55 def check_pred(preds, labels, output_margin):
56 if output_margin:
57 err = sum(
58 1 for i in range(len(preds)) if preds[i].argmax() != labels[i]
59 ) / float(len(preds))
60 else:
61 err = sum(1 for i in range(len(preds)) if preds[i] != labels[i]) / float(
62 len(preds)
63 )
64 assert err < 0.4
65
66 X, y = load_iris(return_X_y=True)
67 kf = KFold(n_splits=2, shuffle=True, random_state=rng)

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected