Skip to content

Issue with 04 ROC function from Result Interpretation #21

Description

@SorinVatamanu

After obtaining susceptibility layer with "y" for landslide presence or absence and "SI" for susceptibility index, when selecting those parameters under ROC, the following error occurs,

Traceback (most recent call last):
File "C:\PROGRA1\QGIS341.5\apps\Python312\Lib\site-packages\pandas\core\indexes\base.py", line 3805, in get_loc
return self._engine.get_loc(casted_key)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "index.pyx", line 167, in pandas._libs.index.IndexEngine.get_loc
File "index.pyx", line 196, in pandas._libs.index.IndexEngine.get_loc
File "pandas\_libs\hashtable_class_helper.pxi", line 7081, in pandas._libs.hashtable.PyObjectHashTable.get_item
File "pandas\_libs\hashtable_class_helper.pxi", line 7089, in pandas._libs.hashtable.PyObjectHashTable.get_item
KeyError: 'y'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "C:\Users/sorin/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\sz_module\sz_module_provider.py", line 434, in processAlgorithm
result=self.dict_of_scripts['function'].process(self,parameters, context, feedback)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users/sorin/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\sz_module\scripts\selfroc.py", line 101, in process
Functions.roc(alg_params)
File "C:\Users/sorin/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\sz_module\scripts\selfroc.py", line 111, in roc
y_true=df['y']
~~^^^^^
File "C:\PROGRA1\QGIS341.5\apps\Python312\Lib\site-packages\pandas\core\frame.py", line 4102, in getitem
indexer = self.columns.get_loc(key)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\PROGRA1\QGIS341.5\apps\Python312\Lib\site-packages\pandas\core\indexes\base.py", line 3812, in get_loc
raise KeyError(key) from err
KeyError: 'y'

Execution failed after 0.81 seconds

It ignores the field names I pass (STRING='SI', STRING2='y') and instead hard-codes df['y']. Even worse, in the same code path, the plugin builds df using ONLY the score column, so y is never added to the DataFrame at all.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions