

def test_FitMutator(self):

    def mutate(Xb, **_):
        self.count += 1
        Xb -= 0.5
    sparse_matrix.nn.callback = {
        'on_batch_start': mutate,
    }
    for t in SPARSE_TYPES:
        sparse_matrix = getattr(scipy.sparse, t)
        X = sparse_matrix((8, 4), dtype=numpy.float32)
        y = numpy.zeros((8, 4), dtype=numpy.float32)
        self.count = 0
        assert_equal(0, self.count)
        self.nn._fit(X, y)
        assert_equal(8, self.count)

dataset/ETHPy150Open aigamedev/scikit-neuralnetwork/sknn/tests/test_types.py TestScipySparseMatrix.test_FitMutator/VarMisuse@33/41 `self`->`sparse_matrix`