[GRASS-dev] RandomForest classifier for imagery groups add-on

Paulo van Breugel p.vanbreugel at gmail.com
Thu Mar 31 02:51:05 PDT 2016

On 26-03-16 18:42, Paulo van Breugel wrote:
> *2nd try - input random sample of 100 points, 1 (12) and 0 (88), with 
> b flag*
> r.randomforest -b igroup=predictors at SampleSize roi=test2 
> output=test2_output ntrees=500 mfeatures=-1 minsplit=2 randst=1 lines=100
> Group <predictors> references the following raster maps:
> Traceback (most recent call last):
>   File "/home/paulo/.grass7/addons/scripts/r.randomforest",
> line 335, in <module>
>     main()
>   File "/home/paulo/.grass7/addons/scripts/r.randomforest",
> line 243, in main
>     class_weight = "balanced", max_features = mfeatures,
> min_samples_split = minsplit, random_state = randst)
> TypeError: __init__() got an unexpected keyword argument
> 'class_weight'
> Removing raster <tmp_jNyNcqZa>
Hi Steven,

I finally found out the above-mentioned problem. I was using an old 
version of the skikit package. In first instance I failed to realize 
this because I had actually upgraded it using:

sudo pip install --upgrade scikit-learn

Just in case others encounter the same problem, the problem was that 
some point I must have installed it through the Synaps package manager 
(I am on Ubuntu), which is a old version. Apparently the version 
installed this way overrides the version installed via pip. Removing the 
package in Synaps package manager (one can of course use apt-get remove) 
resolved it.



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/grass-dev/attachments/20160331/4c5b5a4b/attachment.html>

More information about the grass-dev mailing list