paranormal-or-skeptic/predict.py
2020-04-08 12:35:20 +02:00

14 lines
250 B
Python

def predict(weights, word_to_index, tokenized_text):
ypred = weights[0] # bias or w0
for x in tokenized_text:
if x in word_to_index:
index = word_to_index[x]
ypred += weights[index] * 1
return ypred