This shows you the differences between two versions of the page.
Next revision Both sides next revision | |||
code:model_selection [2015/10/05 13:25] asa created |
code:model_selection [2015/10/05 13:48] asa |
||
---|---|---|---|
Line 20: | Line 20: | ||
</code> | </code> | ||
+ | |||
+ | The simplest form of model evaluation uses a validation/test set: | ||
+ | |||
+ | <code python> | ||
+ | In [9]: X_train, X_test, y_train, y_test = cross_validation.train_test_split(X, y, test_size=0.4, random_state=0) | ||
+ | |||
+ | In [10]: classifier = svm.SVC(kernel='linear', C=1).fit(X_train, y_train) | ||
+ | |||
+ | In [11]: classifier.score(X_test, y_test) | ||
+ | Out[11]: 0.7592592592592593 | ||
+ | |||
+ | |||
+ | </code> | ||
+ |