[GRASS-SVN] r70912 - grass-addons/grass7/raster/r.learn.ml
svn_grass at osgeo.org
svn_grass at osgeo.org
Fri Apr 21 20:42:25 PDT 2017
Author: spawley
Date: 2017-04-21 20:42:25 -0700 (Fri, 21 Apr 2017)
New Revision: 70912
Modified:
grass-addons/grass7/raster/r.learn.ml/r.learn.ml.py
Log:
r.learn.ml fixed issue with mcc scorer attempting to be calculated for multiclass
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-22 03:32:03 UTC (rev 70911)
+++ grass-addons/grass7/raster/r.learn.ml/r.learn.ml.py 2017-04-22 03:42:25 UTC (rev 70912)
@@ -1301,7 +1301,7 @@
# scoring metrics
if mode == 'classification':
- scoring = ['matthews_corrcoef', 'accuracy', 'precision', 'recall', 'f1', 'kappa', 'balanced_accuracy']
+ scoring = ['accuracy', 'precision', 'recall', 'f1', 'kappa', 'balanced_accuracy']
search_scorer = make_scorer(metrics.cohen_kappa_score)
else:
scoring = ['r2', 'neg_mean_squared_error']
@@ -1507,6 +1507,7 @@
if mode == 'classification' and \
len(np.unique(y)) == 2 and all([0, 1] == np.unique(y)):
scoring.append('roc_auc')
+ scoring.append('matthews_corrcoef'),
scores, cscores, fimp = cross_val_scores(
clf, X, y, group_id, class_weights, resampling, scoring,
importances, n_permutations, random_state)
More information about the grass-commit
mailing list