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

Both sides previous revision Previous revision
Next revision Both sides next revision
code:model_selection [2015/10/05 13:48]
asa
code:model_selection [2015/10/05 13:49]
asa
Line 33: Line 33:
  
 </​code>​ </​code>​
 +
 +Next, let'd perform cross-validation:​
 +
 +<code python>
 +
 +In [12]: scores = cross_validation.cross_val_score(classifier,​ X, y, cv=5, scoring='​accuracy'​)
 +
 +In [13]: 
 +
 +In [13]: scores = cross_validation.cross_val_score(classifier,​ X, y, cv=5, scoring='​roc_auc'​)
 +
 +In [14]: # you can also obtain the predictions by cross-validation and then compute the accuracy:
 +
 +In [15]: y_predict = cross_validation.cross_val_predict(classifier,​ X, y, cv=5)
 +
 +In [16]: metrics.accuracy_score(y,​ y_predict)
 +Out[16]: 0.83703703703703702
 +</​code>​
 +
  
code/model_selection.txt ยท Last modified: 2016/10/06 14:58 by asa