Timeline for cross_val_score Scikit Learn not giving expected result
Current License: CC BY-SA 3.0
10 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Oct 22, 2016 at 3:00 | review | First posts | |||
Oct 22, 2016 at 6:11 | |||||
Oct 12, 2016 at 23:30 | vote | accept | FranciscoPedreira | ||
Oct 12, 2016 at 20:10 | comment | added | FranciscoPedreira | Absolutely! As soon as I have the code working i'll check it! Thank you so much for your help!! | |
Oct 12, 2016 at 19:04 | comment | added | nickhamlin | Also, if this answer works for you, could you mark it as accepted by clicking the checkmark? More details here. Thanks! | |
Oct 12, 2016 at 19:02 | comment | added | nickhamlin |
Generally speaking, yes. But, there are ways to make this easier. For example, you can use the kfold object to create the splits for you so you just have to define the comparison once (see the example link in my previous comment). Alternatively, if you DO actually want to use an estimator to make a prediction (rather than just calculating the result manually based on the true and predicted vectors) cross_val_score has a scoring argument that you can use to define whatever outcome metric you want (like recall).
|
|
Oct 12, 2016 at 12:02 | comment | added | FranciscoPedreira | Just one last question (forgive my lack of understanding): I have to split the X in 10 folds and also the y in 10 folds and then run the classification_report on each of the subsets (classification_repor(X1, y1), classification_report(X2, y2), etc) correct? | |
Oct 12, 2016 at 11:59 | comment | added | nickhamlin | I'd use the scikit-learn kfold object to create an iterable of train/test combinations. You can use that to create a loop to evaluate each combination using any criteria you want (accuracy, precision, recall, etc.). Example from sklearn docs is here | |
Oct 12, 2016 at 11:26 | comment | added | FranciscoPedreira | I am almost there! The only problem I have now is that, even though the metrics are correct, it does not perform 10 fold cross validation. Do you know how to apply this function directly to cross validation? Can I use this in conjunction with cross_val_score or a similar function? | |
Oct 12, 2016 at 9:43 | comment | added | FranciscoPedreira | THANK YOU!! I will use this function instead! I can't thank you enough!!! | |
Oct 12, 2016 at 4:09 | history | answered | nickhamlin | CC BY-SA 3.0 |