Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
174aa8ca05
|
|
@ -276,6 +276,7 @@ class StorageEmbeddings:
|
|||
self._add_emebeddings_supervised(docs, labels, config['reduction'], config['max_label_space'], vocs)
|
||||
return self
|
||||
|
||||
|
||||
def predict(self, config, docs):
|
||||
if config['supervised'] and config['unsupervised']:
|
||||
return self._concatenate_embeddings(docs)
|
||||
|
|
@ -288,3 +289,4 @@ class StorageEmbeddings:
|
|||
for lang in docs.keys():
|
||||
_r[lang] = docs[lang].dot(self.lang_U[lang])
|
||||
return _r
|
||||
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ def zscores(x, axis=0): #scipy.stats.zscores does not avoid division by 0, which
|
|||
|
||||
def supervised_embeddings_tfidf(X,Y):
|
||||
tfidf_norm = X.sum(axis=0)
|
||||
tfidf_norm[tfidf_norm==0] = 1
|
||||
F = (X.T).dot(Y) / tfidf_norm.T
|
||||
return F
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue