facebookresearch / StarSpace

Learning embeddings for classification, retrieval and ranking.
MIT License
3.94k stars 531 forks source link

Base doc file cannot be opened for loading #183

Closed helgasvala closed 6 years ago

helgasvala commented 6 years ago

Hey!

I'm trying to get a prediction with query_predict. I followed this guide https://towardsdatascience.com/learning-note-starspace-for-multi-label-text-classification-81de0e8fca53, with other data that I had labeled myself. When I look at the .pred file, it seems to have the right predictions, but I want to be able to make a new prediction with input sentences.

I make a .txt file with some sentences as the base doc file. One of the labels was health, so it looks like this:

tst.txt:

What should this do?
I have a doctor's appointment.
I hope I get my medication in time.

Then I run

./query_predict ./cache/starspace.model ./cache/prufa.txt 1

but I get

Start to load a trained starspace model.
STARSPACE-2017-2
Model loaded.
------Loaded model args:
Arguments: 
lr: 0.01
dim: 100
epoch: 5
maxTrainTime: 8640000
validationPatience: 10
saveEveryEpoch: 0
loss: hinge
margin: 0.05
similarity: cosine
maxNegSamples: 10
negSearchLimit: 50
thread: 10
minCount: 10
minCountLabel: 1
label: __label__
ngrams: 2
bucket: 2000000
adagrad: 1
trainMode: 0
fileFormat: fastText
normalizeText: 0
dropoutLHS: 0
dropoutRHS: 0
Loading base docs from file : 1
Base doc file cannot be opened for loading!

Should the base doc file be in another format?

I also have a question about how to get the overall prediction accuracy of the model, can I do that?

Thank you so much!

ledw commented 6 years ago

Hi @helgasvala , instead of ./query_predict ./cache/starspace.model ./cache/prufa.txt 1 you should run ./query_predict ./cache/starspace.model 1 ./cache/prufa.txt For overall prediction, currently you need to change the code to do that. It is a feature on our to-do list.

ledw commented 6 years ago

Closing issues since there's no recent update.