I am using the following to import MNIST Data:

data = ExampleData[{"MachineLearning", "MNIST"}, "TrainingData"]

How do I get just the data for specific digits e.g. 2,5, 6 etc.?


  • 2
    $\begingroup$ One way Cases[data, Rule[image_, value_] /; MemberQ[{2, 5, 6}, value] ]. $\endgroup$ – b.gates.you.know.what Oct 19 '16 at 12:13
  • $\begingroup$ Thanks. This is exactly what I needed. If you make it an answer, I will mark it as accepted. thanks. $\endgroup$ – Saqib Ali Oct 20 '16 at 4:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.