giacbrd / ShallowLearn

An experiment about re-implementing supervised learning models based on shallow neural network approaches (e.g. fastText) with some additional exclusive features and nice API. Written in Python and fully compatible with Scikit-learn.
GNU Lesser General Public License v3.0
198 stars 30 forks source link

Wrong output #25

Open limapedro opened 6 years ago

limapedro commented 6 years ago

When I try to predict some sentence I get the prediction for each word. Is this a bug?

giacbrd commented 6 years ago

Hi, can you give me an example of input sentence?

limapedro commented 6 years ago

Here my source:

from shallowlearn.models import GensimFastText

clf = GensimFastText(size=100, min_count=0, loss='hs', iter=1, seed=66)'''

clf.fit([('i', 'am', 'tall'), ('you', 'are', 'fat')], ['yes', 'no']) print(clf.predict(['tall', 'am', 'i']))

It outputs: ['no', 'no', 'no'] Instead of just 'no'

giacbrd commented 6 years ago

This is because predict takes a list of samples, while you are passing a single sample: ['tall', 'am', 'i'] Try for example clf.predict([('tall', 'am', 'i')])