# Filtering imported MNIST data

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.?

Thanks.

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