cdQA icon indicating copy to clipboard operation
cdQA copied to clipboard

Can Predict retrieve additional tuples?

Open simontav opened this issue 5 years ago • 5 comments

As far as I can see, the result from the predict (See the below example) returns a list of 4 tuples of (answer, title, paragraph, score/logit). Now I was wondering whether it would be possible to have additional paragraph attributes in the output? (For example, paragraph ID). If Yes, can you please provide information on how to get that? Thanks

cdqa_pipeline.predict(query='question')

simontav avatar Dec 12 '19 20:12 simontav

Hi @simontav

In this PR #332 there is a very very first attempt to retrieve extra columns from CSV. Instead of returning a tuple of 4 values, it returns a dictionary with the original 4 values and the rest of the required data.

You can test it in this way:

cdqa_pipeline.predict(query='question', extra_metadata=['column_1', 'column_2'])

Remember, this is not compatible with the stable version due to the output is not a tuple.

rogelio-meza-t avatar Jan 07 '20 15:01 rogelio-meza-t

Thanks @rogelio-meza-t for your response.I tried to follow all of the changes that was suggested however, I am getting the below error. Do you know what could be the potential reason for such error?

Thank you so much,

Snip20200121_1

simontav avatar Jan 22 '20 01:01 simontav

As a temporary solution, I advise you to replace the titles in the dataframe by some sort of index, and to store another table in parallel where for each index you have the metadata you need.

When you run .predict you can obtain the index from the tuple (at the position 1, which correspond to title). Then, you can map this index to the corresponding metadata.

andrelmfarias avatar Jan 23 '20 16:01 andrelmfarias

thanks @andrelmfarias .

simontav avatar Jan 24 '20 19:01 simontav

Thanks @rogelio-meza-t for your response.I tried to follow all of the changes that was suggested however, I am getting the below error. Do you know what could be the potential reason for such error?

Thank you so much,

Snip20200121_1

Hi @simontav

I'll check what is happening because I don't know exactly where is the bug.

rogelio-meza-t avatar Jan 24 '20 20:01 rogelio-meza-t