[Python] Data leakage with MNIST dataset

Discussão em 'Python' iniciado por Stack, Julho 8, 2025.

  1. Stack

    Stack Membro Participativo

    On first epoch I get around 0.6 accuracy on training set and around .98 on validation set. Can't see how is this possible if I'm using sklearn.train_test_split(). Preparing data:

    for j in range(10):
    for i in range(DATASET_SIZE):
    X.append(mpimg.imread("dataset/dataset/" + str(j) + "/" + str(j) + "/" + str(i) + ".png"))
    y.append(j)
    print('*')
    y = keras.utils.to_categorical(y, num_classes=10)
    X = np.array(X)[:, :, :, -1:]
    X_train, X_valid, y_train, y_valid = train_test_split(X, y, train_size=0.7, random_state=42)


    Passing data to model:

    history = model.fit(X_train, y_train, epochs=3, validation_data=(X_valid, y_valid), callbacks=early_stop)

    Continue reading...

Compartilhe esta Página