SHARE
TWEET

lincalss

a guest Nov 19th, 2019 76 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top