Recognizing Handwritten Digits
Recognizing Handwritten Digits
Make a function that recognizes handwritten digits.
code
code
In[]:=
digit=Classify
1,
2,
1,
2,
4,
8,
9,
9,
3,
7,
1,
5,
5,
2,
7,
3,
8,
9,
8,
2,
0,
9,
7,
1,
5,
3,
7,
8,
9,
4,
7,
2,
7,
1,
7,
5,
9,
8,
8,
5,
0,
1,
5,
2,
9,
2,
9,
5,
9,
2,
1,
2,
3,
5,
9,
3,
1,
3,
3,
1,
9,
3,
3,
9,
2,
9,
9,
1,
8,
8,
0,
7,
7,
7,
0,
6,
2,
3,
8,
3,
1,
2,
6,
4,
1,
6,
3,
7,
3,
0,
1,
9,
0,
7,
1,
9,
9,
2,
7,
2
Out[]=
ClassifierFunction
how it works
how it works
Given a set of training instances, returns a classifier function:
In[]:=
digit=Classify
1,
2,
1,
2,
4,
8,
9,
9,
3,
7,
1,
5,
5,
2,
7,
3,
8,
9,
8,
2,
0,
9,
7,
1,
5,
3,
7,
8,
9,
4,
7,
2,
7,
1,
7,
5,
9,
8,
8,
5,
0,
1,
5,
2,
9,
2,
9,
5,
9,
2,
1,
2,
3,
5,
9,
3,
1,
3,
3,
1,
9,
3,
3,
9,
2,
9,
9,
1,
8,
8,
0,
7,
7,
7,
0,
6,
2,
3,
8,
3,
1,
2,
6,
4,
1,
6,
3,
7,
3,
0,
1,
9,
0,
7,
1,
9,
9,
2,
7,
2
Out[]=
ClassifierFunction
Test the classifier on images that were not in the training set:
In[]:=
digit
,
,
,
,
,
,
,
Out[]=
{1,0,5,3,9,6,5,1}
The classifier will return probabilities of alternative interpretations:
In[]:=
digit
,"TopProbabilities"
Out[]=
{50.538659,80.184401,10.0605155,00.0602013}