Commit aa55bb90 authored by Nishtha Jain's avatar Nishtha Jain
Browse files

predict.py added

parent a5ace933
This source diff could not be displayed because it is too large. You can view the blob instead.
from model import svm_predict, load_model
from preprocessing import embedding_transform
def predict_one(X_test,Y_test, embedding, class_group='medical', sampling='balanced', test_size=0.2, masking=True):
X_test_embedded = embedding_transform(X_test, embedding, class_group, sampling, test_size, masking)
svm_trained_model = load_model('svm', embedding, class_group, sampling, test_size, masking)
prediction = svm_trained_model.predict(X_test_embedded)
return prediction
X_test = ['She works at the hospital','He works at the hospital']
Y_test = ['surgeon','nurse']
pred = predict_one(X_test,Y_test, embedding='w2v', sampling='balanced', masking=True)
for i,x in enumerate(X_test):
print("sent :",x)
print("pred :",pred[i])
print("gr_t :",Y_test[i])
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment