Skip to content

Commit 50ba450

Browse files
author
SebastienMelo
committed
improved conclusion
1 parent ad1ae1d commit 50ba450

1 file changed

Lines changed: 5 additions & 7 deletions

File tree

python_scripts/cross_validation_stratification.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -255,13 +255,11 @@
255255
# train set and the test set. The difference is due to the small number of
256256
# samples in the iris dataset.
257257
#
258-
# In other words, stratifying is more effective than just shuffling when it
259-
# comes to making sure that the distributions of classes in all the folds are
260-
# representative of the entire dataset. As training and testing folds have
261-
# similar class distributions, stratifying leads to a more realistic measure of
262-
# the model’s ability to generalize. This is specially important when the
263-
# performance metrics depend on the proportion of the positive class, as we will
264-
# see in a future notebook.
258+
# Stratification is especially useful for ensuring that rare classes are
259+
# represented in every cross validation split. In particular, if a class is
260+
# absent from one or more splits, some classification metrics may become
261+
# undefined. It is also the case that some performance metrics depend on
262+
# the proportion of the positive class, as we will see in a future notebook.
265263
#
266264
# However, as noted in the [scikit-learn user
267265
# guide](https://scikit-learn.org/stable/modules/cross_validation.html#cross-validation-iterators-with-stratification-based-on-class-labels),

0 commit comments

Comments
 (0)