fani-lab / OpeNTF

Neural machine learning methods for Team Formation problem.
Other
19 stars 14 forks source link

quickstart.ipynb indicates we can train bnn and fnn without other parameters but I get error: UnboundLocalError: local variable 'labels' referenced before assignment #263

Open littlebeanbean7 opened 2 days ago

littlebeanbean7 commented 2 days ago

https://github.com/fani-lab/OpeNTF/blob/main/quickstart.ipynb shows that we can run

python main.py -data ../data/raw/dblp/toy.dblp.v12.json -domain dblp -model bnn python main.py -data ../data/raw/dblp/toy.dblp.v12.json -domain dblp -model fnn

but both of the models will get error message below. I found only if I add "-fairness det_greedy -attribute popularity", this error would disappear -- this contradicts with the quickstart.ipynb.

Traceback (most recent call last): File "main.py", line 210, in run(data_list=args.data_list, File "main.py", line 167, in run mobj.run(splits, vecs, indexes, f'{output_path}', settings['model']['baseline'][baseline_name], settings['model']['cmd'], settings['fair'], merge_skills=False) File "/mnt/data/lingling/OpeNTF/src/mdl/ntf.py", line 141, in run if 'fair' in cmd: self.fair(output, vecs, splits, fair_settings) File "/mnt/data/lingling/OpeNTF/src/mdl/ntf.py", line 88, in fair for fpred, output in pairs: adila.Reranking.run(fpred=fpred, File "/mnt/data/lingling/OpeNTF/src/Adila/src/main.py", line 350, in run stats, labels, ratios = Reranking.get_stats(teamsvecs, coefficient=1, output=output, eq_op=eq_op, att=att) File "/mnt/data/lingling/OpeNTF/src/Adila/src/main.py", line 98, in get_stats return stats, labels, None UnboundLocalError: local variable 'labels' referenced before assignment

hosseinfani commented 2 days ago

@jamil2388 @rezaBarzgar @thangk can any of you look into this and support @littlebeanbean7 . thank you.

jamil2388 commented 2 days ago

Hi @hosseinfani, as far as I can assume, the quickstart.ipynb has become quite outdated here. The error is seemed to be occurring for calling up the main.py from Adila module at some point, which in default cases, should not happen.

Instead of using quickstart.ipynb, I guess the OpeNTF.ipynb is a more suitable started now, as it was updated very recently (5 months ago), compared to the quickstart.ipynb (2 years+ ago). Let me know the suggestions based on your experience please. Thanks!

littlebeanbean7 commented 1 day ago

Hi @jamil2388 thank you for your reply! I looked into OpeNTF.ipynb, it seems contradicts with itself: it says -fairness and -attribute are "optional arguments", however, if I remove the 2 parameters, I get error: UnboundLocalError: local variable 'labels' referenced before assignment.

jamil2388 commented 1 day ago

Hi @littlebeanbean7, we are trying to find out the origin of the problem. We will reach back to you after resolution. Thank you for your patience!

hosseinfani commented 1 day ago

@jamil2388 thanks for the hint.

@Hamedloghmani Ideally, when the user puts fair = None in the setting.py here : https://github.com/fani-lab/OpeNTF/blob/7905ad34028cdec5db661a3bf8e45e158fd6e816/src/param.py#L70

it should not load any package for the Adila. However, due to this line, it does! https://github.com/fani-lab/OpeNTF/blob/7905ad34028cdec5db661a3bf8e45e158fd6e816/src/main.py#L209C5-L209C118

Hamedloghmani commented 1 day ago

Hi @hosseinfani , Thank you for the info. I'm working on the changes, will push soon. Also I'll log and explain the changes in the issues.