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

svn_grass at osgeo.org svn_grass at osgeo.org
Tue May 16 09:00:09 PDT 2017


Author: spawley
Date: 2017-05-16 09:00:09 -0700 (Tue, 16 May 2017)
New Revision: 71092

Modified:
   grass-addons/grass7/raster/r.learn.ml/rlearn_crossval.py
Log:
fixed r2 calculation with r.learn.ml

Modified: grass-addons/grass7/raster/r.learn.ml/rlearn_crossval.py
===================================================================
--- grass-addons/grass7/raster/r.learn.ml/rlearn_crossval.py	2017-05-16 14:04:44 UTC (rev 71091)
+++ grass-addons/grass7/raster/r.learn.ml/rlearn_crossval.py	2017-05-16 16:00:09 UTC (rev 71092)
@@ -185,8 +185,7 @@
     """
 
     from sklearn import metrics
-    from sklearn.model_selection import (
-        RandomizedSearchCV, GridSearchCV, StratifiedKFold)
+    from sklearn.model_selection import StratifiedKFold
     from sklearn.externals.joblib import Parallel, delayed
 
     # -------------------------------------------------------------------------
@@ -317,7 +316,9 @@
             # metrics that have no averaging for multiclass
             elif m == 'kappa' or m == 'specificity' or m == 'accuracy' \
             or m == 'hamming_loss' or m == 'jaccard_similarity' \
-            or m == 'log_loss' or m == 'zero_one_loss' or m == 'matthews_corrcoef':
+            or m == 'log_loss' or m == 'zero_one_loss' \
+            or m == 'matthews_corrcoef' or m == 'r2' \
+            or m == 'neg_mean_squared_error':
                 scores[m] = np.append(
                     scores[m], scoring_methods[m](y_test, y_pred))
 



More information about the grass-commit mailing list