April 2018
Beginner to intermediate
282 pages
6h 52m
English
You can start with logistic regression to test this function:
import numpy as npimport matplotlib.pyplot as pltfrom matplotlib import cm# sklearn.linear_model includes regression models where target variable is a linear combination of input variablesfrom sklearn.linear_model import LogisticRegression# make_moons is another useful function to generate sample datafrom sklearn.datasets import make_moonsfrom sklearn.model_selection import train_test_splitX, y = make_moons(n_samples=1000, noise=0.1, random_state=0)# Plot sample dataplt.scatter(X[:,0], X[:,1], c=y, cmap=cm.cool)plt.show()
We get the following plot:
Now, you can use the draw_decision_boundary function to visualize the decision boundary for ...