Skip to content

Can Predict retrieve additional tuples? #323

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
simontav opened this issue Dec 12, 2019 · 5 comments
Open

Can Predict retrieve additional tuples? #323

simontav opened this issue Dec 12, 2019 · 5 comments

Comments

@simontav
Copy link

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')

rogelio-meza-t added a commit to rogelio-meza-t/cdQA that referenced this issue Jan 7, 2020
@rogelio-meza-t
Copy link

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.

@simontav
Copy link
Author

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

@andrelmfarias
Copy link
Collaborator

andrelmfarias commented Jan 23, 2020

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.

@simontav
Copy link
Author

thanks @andrelmfarias .

@rogelio-meza-t
Copy link

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.

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

No branches or pull requests

3 participants