Commit ad16bb4
[MRG+1] Fix cross_val_predict behavior for binary classification in decision_function (Fixes scikit-learn#9589) (scikit-learn#9593)
* fix cross_val_predict for binary classification in decision_function
* Add unit tests
* Add unit tests
* Add unit tests
* better fix
* fix conflict
* fix broken
* only calculate n_classes if one of 'decision_function', 'predict_proba', 'predict_log_proba'
* add test for SVC ovo in cross_val_predict
* flake8 fix
* fix case of ovo and imbalanced folds for binary classification
* change assert_raises to assert_raise_message for ovo case
* fix flake8 linetoo long
* add comments and clearer tests
* improve comments and error message for OvO
* fix .format error with L
* use assert_raises_regex for better error message
* raise error in decision_function special cases. change predict_log_proba missing classes to minimum numpy value
* fix broken tests due to special cases of decision_function
* add modified test for decision_function behavior that does not trigger edge cases
* fix typos
* fix typos
* escape regex .
* escape regex .
* address comments. one unaddressed comment
* simplify code
* flake
* wrong classes range
* address comments. adjust error message
* add warning
* change warning to runtimewarning
* add test for the warning
* Use assert_warns_message rather than assert_warns
Other minor fixes
* Note on class-absent replacement values
* Improve error message1 parent 2a816fb commit ad16bb4
File tree
2 files changed
+147
-15
lines changed- sklearn/model_selection
- tests
2 files changed
+147
-15
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
644 | 644 | | |
645 | 645 | | |
646 | 646 | | |
| 647 | + | |
| 648 | + | |
| 649 | + | |
| 650 | + | |
| 651 | + | |
| 652 | + | |
| 653 | + | |
| 654 | + | |
| 655 | + | |
647 | 656 | | |
648 | 657 | | |
649 | 658 | | |
| |||
746 | 755 | | |
747 | 756 | | |
748 | 757 | | |
749 | | - | |
750 | | - | |
751 | | - | |
752 | | - | |
753 | | - | |
754 | | - | |
| 758 | + | |
| 759 | + | |
| 760 | + | |
| 761 | + | |
| 762 | + | |
| 763 | + | |
| 764 | + | |
| 765 | + | |
| 766 | + | |
| 767 | + | |
| 768 | + | |
| 769 | + | |
| 770 | + | |
| 771 | + | |
| 772 | + | |
| 773 | + | |
| 774 | + | |
| 775 | + | |
| 776 | + | |
| 777 | + | |
| 778 | + | |
| 779 | + | |
| 780 | + | |
| 781 | + | |
| 782 | + | |
| 783 | + | |
| 784 | + | |
| 785 | + | |
| 786 | + | |
| 787 | + | |
| 788 | + | |
| 789 | + | |
| 790 | + | |
| 791 | + | |
| 792 | + | |
| 793 | + | |
| 794 | + | |
| 795 | + | |
| 796 | + | |
| 797 | + | |
| 798 | + | |
| 799 | + | |
| 800 | + | |
755 | 801 | | |
756 | 802 | | |
757 | 803 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| 27 | + | |
27 | 28 | | |
28 | 29 | | |
29 | 30 | | |
| |||
44 | 45 | | |
45 | 46 | | |
46 | 47 | | |
| 48 | + | |
47 | 49 | | |
48 | 50 | | |
49 | 51 | | |
| |||
54 | 56 | | |
55 | 57 | | |
56 | 58 | | |
57 | | - | |
| 59 | + | |
58 | 60 | | |
59 | 61 | | |
60 | 62 | | |
| |||
800 | 802 | | |
801 | 803 | | |
802 | 804 | | |
| 805 | + | |
| 806 | + | |
| 807 | + | |
| 808 | + | |
| 809 | + | |
| 810 | + | |
| 811 | + | |
| 812 | + | |
| 813 | + | |
| 814 | + | |
| 815 | + | |
| 816 | + | |
| 817 | + | |
| 818 | + | |
| 819 | + | |
| 820 | + | |
| 821 | + | |
| 822 | + | |
| 823 | + | |
| 824 | + | |
| 825 | + | |
| 826 | + | |
| 827 | + | |
| 828 | + | |
| 829 | + | |
| 830 | + | |
| 831 | + | |
| 832 | + | |
| 833 | + | |
| 834 | + | |
| 835 | + | |
| 836 | + | |
| 837 | + | |
| 838 | + | |
| 839 | + | |
| 840 | + | |
| 841 | + | |
| 842 | + | |
| 843 | + | |
| 844 | + | |
| 845 | + | |
| 846 | + | |
| 847 | + | |
| 848 | + | |
| 849 | + | |
| 850 | + | |
| 851 | + | |
| 852 | + | |
| 853 | + | |
| 854 | + | |
| 855 | + | |
| 856 | + | |
| 857 | + | |
| 858 | + | |
| 859 | + | |
| 860 | + | |
| 861 | + | |
| 862 | + | |
| 863 | + | |
| 864 | + | |
| 865 | + | |
| 866 | + | |
| 867 | + | |
| 868 | + | |
| 869 | + | |
| 870 | + | |
| 871 | + | |
| 872 | + | |
| 873 | + | |
| 874 | + | |
| 875 | + | |
| 876 | + | |
| 877 | + | |
| 878 | + | |
| 879 | + | |
| 880 | + | |
| 881 | + | |
| 882 | + | |
| 883 | + | |
| 884 | + | |
| 885 | + | |
| 886 | + | |
| 887 | + | |
803 | 888 | | |
804 | 889 | | |
805 | 890 | | |
| |||
1241 | 1326 | | |
1242 | 1327 | | |
1243 | 1328 | | |
1244 | | - | |
1245 | | - | |
1246 | | - | |
| 1329 | + | |
| 1330 | + | |
1247 | 1331 | | |
1248 | | - | |
| 1332 | + | |
| 1333 | + | |
| 1334 | + | |
1249 | 1335 | | |
1250 | 1336 | | |
1251 | 1337 | | |
1252 | 1338 | | |
1253 | 1339 | | |
1254 | 1340 | | |
1255 | 1341 | | |
1256 | | - | |
1257 | | - | |
1258 | | - | |
| 1342 | + | |
| 1343 | + | |
| 1344 | + | |
1259 | 1345 | | |
1260 | 1346 | | |
1261 | 1347 | | |
| |||
1283 | 1369 | | |
1284 | 1370 | | |
1285 | 1371 | | |
1286 | | - | |
| 1372 | + | |
1287 | 1373 | | |
1288 | 1374 | | |
1289 | 1375 | | |
| |||
0 commit comments