[GRASS-SVN] r68208 - grass-addons/grass7/raster/r.randomforest
svn_grass at osgeo.org
svn_grass at osgeo.org
Mon Apr 4 10:25:14 PDT 2016
Author: spawley
Date: 2016-04-04 10:25:14 -0700 (Mon, 04 Apr 2016)
New Revision: 68208
Modified:
grass-addons/grass7/raster/r.randomforest/r.randomforest.py
Log:
r.randomforest output class probabilities by class number
Modified: grass-addons/grass7/raster/r.randomforest/r.randomforest.py
===================================================================
--- grass-addons/grass7/raster/r.randomforest/r.randomforest.py 2016-04-03 20:37:42 UTC (rev 68207)
+++ grass-addons/grass7/raster/r.randomforest/r.randomforest.py 2016-04-04 17:25:14 UTC (rev 68208)
@@ -324,6 +324,7 @@
# Determine the number of class labels using np.unique
nclasses = len(np.unique(training_labels))
+ class_list = np.unique(training_labels)
# attach training label values onto last dimension of numpy array
training_data[0:nlabel_pixels, nbands] = training_labels
@@ -407,7 +408,7 @@
prob_out_raster = [0] * nclasses
prob = [0] * nclasses
for iclass in range(nclasses):
- prob_out_raster[iclass] = output + '_p' + str(iclass)
+ prob_out_raster[iclass] = output + '_p' + str(class_list[iclass])
prob[iclass] = RasterRow(prob_out_raster[iclass])
prob[iclass].open('w', 'FCELL', overwrite=True)
More information about the grass-commit
mailing list