Skip to content

Is data distribution consistent between training and test sets? #17

Description

@fruboes

I wanted to see how classifier accuracy for Kuzushiji-MNIST behaves wrt varying training set size. My procedure was the following:

  1. Sample a small-sized dataset from the full training dataset, making sure each class has the same number of images
  2. Estimate the classifier (KNN) accuracy with cross-validation (applied to the dataset created in 1.)
  3. Estimate the classifier (again KNN, with same parameters) accuracy using the test set (i.e. train the KNN classifier on the full dataset obtained in 1., estimate accuracy on last 10000 images from KMNIST)
  4. Compare values obtained in 2. and 3.

To my surprise, classifier efficiency obtained with cross-validation was always significantly higher than the one obtained with the test set:

  • train_size: 200

    • xval efficiency: 0.64 pm 0.03
    • test set effic.: 0.52 pm 0.02
  • train_size: 500

    • xval efficiency: 0.75 pm 0.02
    • test set effic.: 0.61 pm 0.02
  • train_size: 1000

    • xval efficiency: 0.81 pm 0.01
    • test set effic.: 0.68 pm 0.01

After a fair amount of debugging I've found out, that effect completely disappears if I merge train and test parts, shuffle the result, and then define new train and test datasets (60000 and 10000 images respectively, with class balancing ensured). For such datasets the results seem consistent for both methods used:

  • train_size: 200

    • xval efficiency: 0.63 pm 0.03
    • test set effic.: 0.67 pm 0.01
  • train_size: 500

    • xval efficiency: 0.74 pm 0.01
    • test set effic.: 0.76 pm 0.01
  • train_size: 1000

    • xval efficiency: 0.80 pm 0.01
    • test set effic.: 0.82 pm 0.01

The above may suggest, that the original training and test parts of Kuzushiji-MNIST are somehow different. Could you have a look at this? Please find the test code producing the above results attached ( compare_xval_and_test.zip ).

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