Write the Python function
classify(features, weights)
that uses a perceptron to classify a sample. The parameter features is a one-dimensional Numpy array of floats of the sample’s features. The parameter weights is a one-dimensional Numpy array of floats that contains the perceptron’s weights. If there are m features then there must be m + 1 weights. The first weight is the perceptron’s bias.For example:
= np.array([0.2962963, 0.625]) features = np.array([0.57501319, 1.34218874, -1.36311653]) weights print(classify(features, weights)) # should print 0 = np.array([0.51851852, 0.33333333]) features = np.array([0.57501319, 1.34218874, -1.36311653]) weights print(classify(features, weights)) # should print 1