<SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
 Digit Recognition using a Support Vector Machine
Step1:  The function $\texttt{load_data}()$ returns a pair of the form
$$ (\texttt{training_data}, \texttt{test_data}) $$
where 
<ul>
<li> $\texttt{training_data}$ is a list containing 60,000 pairs $(\textbf{x}, y)$ s.t. $\textbf{x}$ is a 784-dimensional `numpy.ndarray` containing the input image and $y$ is the digit that is supposed to be shown in the image $\textbf{x}$.</li>
<li> $\texttt{test_data}$ is a list containing 10,000 pairs $(\textbf{x}, y)$.  In each case, 
     $\textbf{x}$ is a 784-dimensional `numpy.ndarry` containing the input image, 
     and $y$ is the corresponding digit value.
</ul>
Step2:  Let us see what we have read
Step3:  We define a support vector machine with Gaussian kernel.
<ASSISTANT_TASK:>
Python Code:
import gzip
import pickle
import numpy       as np
import sklearn.svm as svm
Explanation: Digit Recognition using a Support Vector Machine
End of explanation
def load_data():
    with gzip.open('../mnist.pkl.gz', 'rb') as f:
        train, validate, test = pickle.load(f, encoding="latin1")
    X_train = np.array([np.reshape(x, (784, )) for x in train[0]])
    X_test  = np.array([np.reshape(x, (784, )) for x in test [0]])
    Y_train = np.array(train[1])
    Y_test  = np.array(test [1])
    return (X_train, X_test, Y_train, Y_test)
X_train, X_test, Y_train, Y_test = load_data()
Explanation: The function $\texttt{load_data}()$ returns a pair of the form
$$ (\texttt{training_data}, \texttt{test_data}) $$
where 
<ul>
<li> $\texttt{training_data}$ is a list containing 60,000 pairs $(\textbf{x}, y)$ s.t. $\textbf{x}$ is a 784-dimensional `numpy.ndarray` containing the input image and $y$ is the digit that is supposed to be shown in the image $\textbf{x}$.</li>
<li> $\texttt{test_data}$ is a list containing 10,000 pairs $(\textbf{x}, y)$.  In each case, 
     $\textbf{x}$ is a 784-dimensional `numpy.ndarry` containing the input image, 
     and $y$ is the corresponding digit value.
</ul>
End of explanation
X_train.shape, X_test.shape, Y_train.shape, Y_test.shape
Explanation: Let us see what we have read:
End of explanation
M = svm.SVC(kernel='rbf', gamma=0.05, C=5)
%%time
M.fit(X_train, Y_train)
M.score(X_train, Y_train)
M.score(X_test, Y_test)
Explanation: We define a support vector machine with Gaussian kernel.
End of explanation
<END_TASK>