Skip to content

MNIST normalization error #4

@yt7589

Description

@yt7589

I failed to pass the last test case of parse_mnist.
My environment: windows 10, anaconada3, python 3.8
My codes as below:
My code snip 1:

(removed)

My code snip 2:

(removed)

They all reported the same error message as below:

    def test_parse_mnist():
        X,y = parse_mnist("data/train-images-idx3-ubyte.gz",
                          "data/train-labels-idx1-ubyte.gz")
        assert X.dtype == np.float32
        assert y.dtype == np.uint8
        assert X.shape == (60000,784)
        assert y.shape == (60000,)
        np.testing.assert_allclose(np.linalg.norm(X[:10]), 27.892084)
>       np.testing.assert_allclose(np.linalg.norm(X[:1000]), 293.0717,
        #np.testing.assert_allclose(np.linalg.norm(X[:1000]), 293.071838,
            err_msg="""If you failed this test but not the previous one,
            you are probably normalizing incorrectly. You should normalize
            w.r.t. the whole dataset, _not_ individual images.""")
E       AssertionError:
E       Not equal to tolerance rtol=1e-07, atol=0
E       If you failed this test but not the previous one,
E               you are probably normalizing incorrectly. You should normalize
E               w.r.t. the whole dataset, _not_ individual images.
E       Mismatched elements: 1 / 1 (100%)
E       Max absolute difference: 0.00013838
E       Max relative difference: 4.72167412e-07
E        x: array(293.07184, dtype=float32)
E        y: array(293.0717)

tests\test_simple_ml.py:40: AssertionError

My question is how to do the normalization?

By the way I am in china mainland. I failed to register to this course. I filled the enroll form without much difficulty. But when I login this course it said that my email is not exist. I hadn't received any email via my email address. How to register to this class in Chain mainland?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions