Issue with fetching Label Value in DL4J paragraphVector model from vec.nearestLabel() method

Does paragraphvector.nearestLabel() method fetch the content also with some method or is there any other way to do the same. Been trying to fetch label value from paragraphvector.nearestLabel(String rawtext, int TopN//nearest label to text) but am unable to fetch the value the only thing the method is fetch is label_Name_Number but i want to extract the content associated with

@Ujjwal2805 could you specify code you’ve attempted so far and a bit about your setup? I’m also not very clear on what you want. Could you rewrite your question maybe?
Could you clarify what you mean by “content”? The label text?

1 Like

Here is the code I am trying to fetch the values in answers columns from my csv file but the model after training on same data is only returning LabelName_ColumnNumber is there a method to fetch the entire content from the answer column instead of LabelName_Number . like in my case its answer2 or answer4 like that is returned.

After training the model this is the final value as output from model.

@agibsonccc Can you please share your views on this .

@Ujjwal2805 you can only get back the labels. All it does is runs a nearest neighbor search relative to the label. There’s no “content” associated with that besides the label.
I actually don’t know what functionality you would expect to exist there. It’s just an embeddings based search. In word2vec and the like you can get back nearest words. You could also nearest documents. There’s no getting back “content” from a non existent document though.

I might be misunderstanding about what you want content to be.

I’m not seeing “answer4” anywhere in your sample here. Could you add that?

It’s my understanding you want to do question answering using pv nearest neighbors search. You would need a lot more code to make that work since PV itself is fairly simple. The best you would be able to do is get the most similar documents to a label.

Is that what you’re looking for?

@agibsonccc I am referring the content here as the data that is in relative columns. Like when i search for What is capital of France instead of returning answer4 or answer5 it shoud return the string in B5 Column that is “Paris” is it possible to fetch it that way. Here the answer4 it is returning is just label with number , I am passing “answer” as labelsource while training the Paragraph vector model. Now as it correlates Data with labels its relating every question column data with answer label and returning its column number.