(A, M)
| 64 | |
| 65 | |
| 66 | def generator(A, M): |
| 67 | while True: |
| 68 | A, M = shuffle(A, M) |
| 69 | for i in range(A.shape[0] // batch_size + 1): |
| 70 | upper = min((i+1)*batch_size, A.shape[0]) |
| 71 | a = A[i*batch_size:upper].toarray() |
| 72 | m = M[i*batch_size:upper].toarray() |
| 73 | a = a - mu * m # must keep zeros at zero! |
| 74 | # m2 = (np.random.random(a.shape) > 0.5) |
| 75 | # noisy = a * m2 |
| 76 | noisy = a # no noise |
| 77 | yield noisy, a |
| 78 | |
| 79 | |
| 80 | def test_generator(A, M, A_test, M_test): |