Skip to content
This repository has been archived by the owner on Jan 13, 2023. It is now read-only.

Prediction works for direct_nlp but crashes for hybrid and None/default #15

Open
howff opened this issue Jan 17, 2022 · 4 comments
Open

Comments

@howff
Copy link

howff commented Jan 17, 2022

With predict_mode set to hybrid

[predict_helper.py:26] root 2022-01-17 16:18:18,330 working on [atrophy]
Traceback (most recent call last):
  File "nlp2phenome/predict_helper.py", line 184, in <module>
    predict_to_eHOST_results(sys.argv[1])
  File "nlp2phenome/predict_helper.py", line 165, in predict_to_eHOST_results
    predicted_results = hybrid_prediciton(ss.settings)
  File "nlp2phenome/predict_helper.py", line 78, in hybrid_prediciton
    d2p, labels2work = predict(settings)
  File "nlp2phenome/predict_helper.py", line 43, in predict
    full_text_dir=test_text_dir)
TypeError: load_data_for_predict() got an unexpected keyword argument 'concept_mapping_file'

Without predict_mode

[predict_helper.py:167] root 2022-01-17 16:18:45,485 predicting...
[predict_helper.py:26] root 2022-01-17 16:18:45,486 working on [atrophy]
Traceback (most recent call last):
  File "nlp2phenome/predict_helper.py", line 184, in <module>
    predict_to_eHOST_results(sys.argv[1])
  File "nlp2phenome/predict_helper.py", line 168, in predict_to_eHOST_results
    predicted_results = predict(ss.settings)
  File "nlp2phenome/predict_helper.py", line 43, in predict
    full_text_dir=test_text_dir)
TypeError: load_data_for_predict() got an unexpected keyword argument 'concept_mapping_file'
@Honghan
Copy link
Member

Honghan commented Feb 18, 2022

Just updated the predict_helper to fix the issue. This was caused by a code cleaning done back in 2020.

@howff
Copy link
Author

howff commented Feb 24, 2022

After applying abff606
Now it gives a different error

    lm.concept_mapping = _cm_obj
AttributeError: can't set attribute

@howff
Copy link
Author

howff commented Feb 24, 2022

We can solve that error if we change lm.concept_mapping = _cm_obj into lm._concept_mapping = _cm_obj

However then we get another error (in None/default mode)

in output_eHOST_format
    xml = AnnConverter.to_eHOST(d, doc2precited[d])
TypeError: tuple indices must be integers or slices, not dict

@Honghan
Copy link
Member

Honghan commented Feb 25, 2022

No - it's my bad - forgot to push another file LabelModel.py which I had added a function to allow attribute setting.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants