Advertisement
Guest User

lincalss

a guest
Nov 19th, 2019
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1. import numpy as np
  2. def linclass(weight, bias, data):
  3. # Linear Classifier
  4. #
  5. # INPUT:
  6. # weight : weights (dim x 1)
  7. # bias : bias term (scalar)
  8. # data : Input to be classified (num_samples x dim)
  9. #
  10. # OUTPUT:
  11. # class_pred : Predicted class (+-1) values (num_samples x 1)
  12. class_pred = np.sign((np.matmul(data,np.transpose(weight)) + bias))
  13. print(class_pred)
  14.  
  15. return class_pred
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement