Guest User

Untitled

a guest
Jan 23rd, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.47 KB | None | 0 0
  1. pos_hmean = term_freq_df2.pos_normcdf_hmean
  2.  
  3. y_val_predicted_proba = []
  4. for t in x_validation:
  5. hmean_scores = [pos_hmean[w] for w in t.split() if w in pos_hmean.index]
  6. if len(hmean_scores) > 0:
  7. prob_score = np.mean(hmean_scores)
  8. else:
  9. prob_score = np.random.random()
  10. y_val_predicted_proba.append(prob_score)
  11.  
  12. pred = [1 if t > 0.56 else 0 for t in y_val_predicted_proba]
  13.  
  14. from sklearn.metrics import accuracy_score
  15. accuracy_score(y_validation,pred)
Add Comment
Please, Sign In to add comment