MCPcopy Index your code
hub / github.com/makelove/OpenCV-Python-Tutorial / f

Function f

官方samples/digits_adjust.py:33–45  ·  view source on GitHub ↗
(i)

Source from the content-addressed store, hash-verified

31 n = len(samples)
32 folds = np.array_split(np.arange(n), kfold)
33 def f(i):
34 model = model_class(**params)
35 test_idx = folds[i]
36 train_idx = list(folds)
37 train_idx.pop(i)
38 train_idx = np.hstack(train_idx)
39 train_samples, train_labels = samples[train_idx], labels[train_idx]
40 test_samples, test_labels = samples[test_idx], labels[test_idx]
41 model.train(train_samples, train_labels)
42 resp = model.predict(test_samples)
43 score = (resp != test_labels).mean()
44 print(".", end='')
45 return score
46 if pool is None:
47 scores = list(map(f, xrange(kfold)))
48 else:

Callers

nothing calls this directly

Calls 2

trainMethod · 0.45
predictMethod · 0.45

Tested by

no test coverage detected