Same model different prediction results
I'm having a binary classification use case and trained the model in C++ (with non-default hyper parameters). However, I'm getting completely different prediction results with the same test cases in C++ and in fasttext4j (results from C++ are correct for the 10 cases i tested).
Any help or explanation would be appreciated!
Thanks, Catherine
hi Catherine, can u send me the demo binary model and the test case , so i can used to reproduce this problem. Email: [email protected] thanks
Sent! Thanks, Catherine
in dictionary.cc
int32_t Dictionary::getLine(std::istream& in,
std::vector<int32_t>& words,
std::vector<int32_t>& labels) const {
std::vector<int32_t> word_hashes;
std::string token;
int32_t ntokens = 0;
reset(in);
words.clear();
labels.clear();
while (readWord(in, token)) {
uint32_t h = hash(token);
int32_t wid = getId(token, h);
entry_type type = wid < 0 ? getType(token) : getType(wid);
int32_t xx = h;
uint64_t t = xx;
std::cout << "read word" << token << " hash " << h << " int32 " << xx << " uint64 " <<t <<" wid " << wid << std::endl;
ntokens++;
if (type == entry_type::word) {
addSubwords(words, token, wid);
word_hashes.push_back(h);
} else if (type == entry_type::label && wid >= 0) {
labels.push_back(wid - nwords_);
}
if (token == EOS) break;
}
addWordNgrams(words, word_hashes, args_->wordNgrams);
return ntokens;
}
word hash ,from uint32 -> int32 ->uint64 some outpus
read word^ hash 3675003649 int32 -619963647 uint64 18446744073089587969 wid 1
but in java,just long,so get different result.
you can train data use fastText4j, then test predict result. I will test the new code to see if fix this error.
v1.1.1 fix this bug. Thanks to Catherine for providing the data model for testing.