Advertisement
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
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement