[GRASS-dev] [GRASS GIS] #3390: r.learn.ml crossvalidation fails if category map class codes increase more then +1

#3390: r.learn.ml crossvalidation fails if category map class codes increase more
then +1
--------------------+-------------------------
Reporter: maitl | Owner: grass-dev@…
     Type: defect | Status: new
Priority: normal | Milestone: 7.2.2
Component: Addons | Version: unspecified
Keywords: | CPU: All
Platform: All |
--------------------+-------------------------
Crossvalidation fails if class ID values in category maps do not increase
strictly by +1 i.e 1, 2, 3, 4, 5, 6 ... .

E.g. a cass code list 10, 11, 12, 13, 25, 26 is not handled properly.

The bug is here:

if mode == 'classification' and cv > np.histogram(
                     y, bins=len(np.unique(y)))[0].min():

The solution is to use

if mode == 'classification' and cv > np.histogram(
                    y, bins=np.unique(y))[0].min():

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/3390&gt;
GRASS GIS <https://grass.osgeo.org>

#3390: r.learn.ml crossvalidation fails if category map class codes increase more
then +1
---------------------+-------------------------
  Reporter: maitl | Owner: grass-dev@…
      Type: defect | Status: new
  Priority: normal | Milestone: 7.2.2
Component: Addons | Version: unspecified
Resolution: | Keywords:
       CPU: All | Platform: All
---------------------+-------------------------
Changes (by maitl):

* Attachment "r.learn.ml" added.

r.learn.ml with bugfix example

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/3390&gt;
GRASS GIS <https://grass.osgeo.org>

#3390: r.learn.ml crossvalidation fails if category map class codes increase more
then +1
---------------------+-------------------------
  Reporter: maitl | Owner: grass-dev@…
      Type: defect | Status: closed
  Priority: normal | Milestone: 7.2.2
Component: Addons | Version: unspecified
Resolution: fixed | Keywords:
       CPU: All | Platform: All
---------------------+-------------------------
Changes (by spawley):

* status: new => closed
* resolution: => fixed

Comment:

Thanks for reporting this and providing the bug fix. This has been updated
in the Add-Ons in #71358 and I'm closing the ticket.

Steve

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/3390#comment:1&gt;
GRASS GIS <https://grass.osgeo.org>