application_vnd.jupyter.stderr_output_1.png
from sklearn.grid_search import GridSearchCV

import numpy as np # linear algebra

import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)

train = pd.read_csv('../input/train.csv')
test = pd.read_csv('../input/test.csv')
y_train = train.label.values.ravel()
X_train = train.values[:, 1:]
X_test = test.values

def normalized_data():
    X = np.concatenate((X_train, X_test))
    x_test = X_test - X.mean(0)
    x_train = X_train - X.mean(0)
    x_test /= x_test.std(1).reshape((-1, 1))
    x_train /= x_train.std(1).reshape((-1, 1))
    return (x_train, x_test)

from sklearn.grid_search import GridSearchCV
from sklearn.svm import SVC
def testCLF(clf, parameters, X):
    search = GridSearchCV(clf, parameters)
    search.fit(X, y_train)
    print(search.score)
    return search.best_estimator_