AttributeError: 'RandomForestRegressor' object has no attribute 'min_impurity_split'

Issue #1324 on hold
Benjamin Jakimow created an issue

AttributeError is raised when openen the Example Test data:

How to reproduce: run test_instance_coreapps_and_data in tests/src/test_enmapbox.py

Traceback:

Traceback (most recent call last):
  File "C:\Users\geo_beja\Repositories\enmap-box\tests\src\test_enmapbox.py", line 171, in test_instance_coreapps_and_data
    EMB.openExampleData(mapWindows=1, testData=True)
  File "C:\Users\geo_beja\Repositories\enmap-box\enmapbox\gui\enmapboxgui.py", line 1725, in openExampleData
    self.addSources(files)
  File "C:\Users\geo_beja\Repositories\enmap-box\enmapbox\gui\enmapboxgui.py", line 1914, in addSources
    return self.mDataSourceManager.addDataSources(sourceList)
  File "C:\Users\geo_beja\Repositories\enmap-box\enmapbox\gui\datasources\manager.py", line 268, in addDataSources
    sources = DataSourceFactory.create(sources, provider=provider, name=name)
  File "C:\Users\geo_beja\Repositories\enmap-box\enmapbox\gui\datasources\manager.py", line 839, in create
    results.extend(DataSourceFactory.create(s, provider=provider, name=name))
  File "C:\Users\geo_beja\Repositories\enmap-box\enmapbox\gui\datasources\manager.py", line 931, in create
    results.append(ModelDataSource(dataItem))
  File "C:\Users\geo_beja\Repositories\enmap-box\enmapbox\gui\datasources\datasources.py", line 255, in __init__
    self.updateNodes()
  File "C:\Users\geo_beja\Repositories\enmap-box\enmapbox\gui\datasources\datasources.py", line 287, in updateNodes
    self.mObjectNode = PyObjectTreeNode(obj=self.mPklObject, name='Content')
  File "C:\Users\geo_beja\Repositories\enmap-box\enmapbox\qgispluginsupport\qps\models.py", line 773, in __init__
    value = str(obj)
  File "F:\OSGeo4W\apps\Python39\lib\site-packages\sklearn\base.py", line 260, in __repr__
    repr_ = pp.pformat(self)
  File "F:\OSGeo4W\apps\Python39\lib\pprint.py", line 153, in pformat
    self._format(object, sio, 0, 0, {}, 0)
  File "F:\OSGeo4W\apps\Python39\lib\pprint.py", line 170, in _format
    rep = self._repr(object, context, level)
  File "F:\OSGeo4W\apps\Python39\lib\pprint.py", line 431, in _repr
    repr, readable, recursive = self.format(object, context.copy(),
  File "F:\OSGeo4W\apps\Python39\lib\site-packages\sklearn\utils\_pprint.py", line 180, in format
    return _safe_repr(object, context, maxlevels, level,
  File "F:\OSGeo4W\apps\Python39\lib\site-packages\sklearn\utils\_pprint.py", line 425, in _safe_repr
    params = _changed_params(object)
  File "F:\OSGeo4W\apps\Python39\lib\site-packages\sklearn\utils\_pprint.py", line 91, in _changed_params
    params = estimator.get_params(deep=False)
  File "F:\OSGeo4W\apps\Python39\lib\site-packages\sklearn\base.py", line 195, in get_params
    value = getattr(self, key)
AttributeError: 'RandomForestRegressor' object has no attribute 'min_impurity_split'

Comments (5)

  1. Benjamin Jakimow reporter

    Seems to be caused by the outdated OSGEO4W scikit-learn (0.23.2-1).
    Works with 1.0.2 (installed via pip install scikit-learn --user), but here I run into the following (none-blocking) error message:

    <enmapbox.gui.datasources.datasources.ModelDataSource object at 0x000001A7B7167C10>:: Unable to load C:/Users/geo_beja/Repositories/enmap-box/tests/testdata/regressor_singletarget.pkl: No module named 'sklearn.ensemble._forest'
    

  2. Andreas Rabe

    I can’t reproduce the AttributeError nor the modul import error.

    Box looks like this after running the test:

  3. Log in to comment