Last active
December 25, 2015 22:29
-
-
Save elyase/7050488 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Split the dataset in two equal parts | |
X_train, X_test, y_train, y_test = train_test_split( | |
X, y, test_size=0.5, random_state=0) | |
# Set the parameters by cross-validation | |
tuned_parameters = [{'kernel': ['rbf'], 'gamma': [1e-3, 1e-4], | |
'C': [1, 10, 100, 1000]}, | |
{'kernel': ['linear'], 'C': [1, 10, 100, 1000]}] | |
model = GridSearchCV(SVC(C=1), tuned_parameters, cv=5, scoring=score) | |
model.fit(X_train, y_train) | |
print(model.best_estimator_) | |
y_true, y_pred = y_test, model.predict(X_test) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment