machine learning working with images isn' much different from working with other data sets in the case of gray imageyou put value in every matrix entry that depicts the gray value to be shown the following code demonstrates this process and is step four of the data science processdata exploration listing step of the data science processusing scikit-learn pl gray(pl matshow(digits images[ ]pl show(digits images[ shows first images turns image into gray-scale values shows the corresponding matrix figure shows how blurry " image translates into data matrix figure shows the actual code outputbut perhaps figure can clarify this slightlybecause it shows how each element in the vector is piece of the image easy so farisn' itthere isnaturallya little more work to do the naive bayes classifier is expecting list of valuesbut pl matshow(returns two-dimensional array ( matrixreflecting the shape of the image to flatten it into listwe need to call reshape(on digits images the net result will be one-dimensional array that looks something like thisarray([ ]]figure blurry grayscale representation of the number with its corresponding matrix the higher the numberthe closer it is to whitethe lower the numberthe closer it is to black