Warning: Declaration of action_plugin_tablewidth::register(&$controller) should be compatible with DokuWiki_Action_Plugin::register(Doku_Event_Handler $controller) in /s/bach/b/class/cs545/public_html/fall16/lib/plugins/tablewidth/action.php on line 93
code:model_selection [CS545 fall 2016]

User Tools

Site Tools


code:model_selection

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

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>​
 +
code/model_selection.txt ยท Last modified: 2016/10/06 14:58 by asa