SHARE
TWEET

lincalss




Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
- import numpy as np
- def linclass(weight, bias, data):
- # Linear Classifier
- #
- # INPUT:
- # weight : weights (dim x 1)
- # bias : bias term (scalar)
- # data : Input to be classified (num_samples x dim)
- #
- # OUTPUT:
- # class_pred : Predicted class (+-1) values (num_samples x 1)
- class_pred = np.sign((np.matmul(data,np.transpose(weight)) + bias))
- print(class_pred)
- 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.