NUAA-AL / ALiPy

ALiPy: Active Learning in Python is an active learning python toolbox, which allows users to conveniently evaluate, compare and analyze the performance of active learning methods.

Home Page:http://parnec.nuaa.edu.cn/huangsj/alipy/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Possible bug in get_query_strategy inside toolbox.py

Arshita27 opened this issue · comments

ALiPy/alipy/toolbox.py

Lines 402 to 409 in 71d716d

if kwargs.pop('train_idx', None) is None:
raise ValueError(
"Missing necessary parameter 'train_idx' in GraphDensity or QUIRE method.")
if strategy_name == 'QueryInstanceGraphDensity':
query_function = QueryInstanceGraphDensity(self._X,
self._y,
train_idx=kwargs.pop(
'train_idx'))

When I tried to run ''QueryInstanceGraphDensity' it gave me an error: "Missing key 'train_idx' ", even when I was providing this key.

One possible bug could be that in line 402, kwargs.pop('train_idx', None) is being called which removes the train_idx key from the dictionary. Thus when it is called again in line 408, it gives an error as the key is no longer present due to the previous 'pop' statement.

Do let me know if I am missing out anything.

Hi,

Thank you for your reporting, and we will fix this problem in the next release which will be published recently.
For now, please import the 'QueryInstanceGraphDensity' strategy independently for using it.
Here is an example:

from alipy.query_strategy.query_labels import QueryInstanceGraphDensity
density_strategy = QueryInstanceGraphDensity(X, y ,train_idx)