()
| 40 | |
| 41 | |
| 42 | def test_fit_callback(): |
| 43 | num_called = 0 |
| 44 | |
| 45 | def callback(epoch, elapsed, correct, skipped): |
| 46 | nonlocal num_called |
| 47 | num_called += 1 |
| 48 | |
| 49 | raw = [ |
| 50 | [1, 1, 0, 1, 0, 0], |
| 51 | [0, 1, 1, 1, 0, 0], |
| 52 | [1, 0, 1, 0, 0, 0], |
| 53 | [1, 1, 0, 0, 0, 0], |
| 54 | [0, 0, 1, 1, 0, 1], |
| 55 | [0, 1, 0, 0, 0, 1], |
| 56 | [0, 0, 0, 0, 1, 1], |
| 57 | ] |
| 58 | model = BayesianPersonalizedRanking(iterations=5, use_gpu=False) |
| 59 | |
| 60 | model.fit(csr_matrix(raw), show_progress=False, callback=callback) |
| 61 | assert num_called == model.iterations |
nothing calls this directly
no test coverage detected