INNER CODE UNIT · Python
predict
rasbt/machine-learning-book · ch02/ch02.py:156
def predict(self, X):
"""Return class label after unit step"""
return np.where(self.net_input(X) >= 0.0, 1, 0)
v1 = np.array([1, 2, 3])
v2 = 0.5 * v1
np.arccos(v1.dot(v2) / (np.linalg.norm(v1) * np.linalg.norm(v2)))
# ## Training a perceptron model on the Iris dataset
# ...
# ### Reading-in the Iris data