[GRASS-SVN] r70959 - grass-addons/grass7/raster/r.learn.ml

svn_grass at osgeo.org svn_grass at osgeo.org
Wed Apr 26 10:42:50 PDT 2017


Author: spawley
Date: 2017-04-26 10:42:50 -0700 (Wed, 26 Apr 2017)
New Revision: 70959

Modified:
   grass-addons/grass7/raster/r.learn.ml/r.learn.ml.py
Log:
r.learn fixed issue when performing no cross validation

Modified: grass-addons/grass7/raster/r.learn.ml/r.learn.ml.py
===================================================================
--- grass-addons/grass7/raster/r.learn.ml/r.learn.ml.py	2017-04-26 14:29:14 UTC (rev 70958)
+++ grass-addons/grass7/raster/r.learn.ml/r.learn.ml.py	2017-04-26 17:42:50 UTC (rev 70959)
@@ -592,17 +592,18 @@
                 inner = ShuffleSplit(n_splits=1, test_size=0.33, random_state=random_state)
             else:
                 inner = GroupShuffleSplit(n_splits=1, test_size=0.33, random_state=random_state)
-        
+
         else:
             inner = None
 
         # ---------------------------------------------------------------------
         # define the outer search resampling method
         # ---------------------------------------------------------------------
-        if group_id is None:
-            outer = StratifiedKFold(n_splits=cv, random_state=random_state)
-        else:
-            outer = GroupKFold(n_splits=cv)
+        if cv > 1:
+            if group_id is None:
+                outer = StratifiedKFold(n_splits=cv, random_state=random_state)
+            else:
+                outer = GroupKFold(n_splits=cv)
 
         # ---------------------------------------------------------------------
         # define sample weights for gradient boosting classifiers



More information about the grass-commit mailing list