From 9e7a660ff665a6db3b2fb1a31301191c1ba5cce2 Mon Sep 17 00:00:00 2001 From: Jack Martin Date: Tue, 31 Mar 2015 10:38:47 -0400 Subject: [PATCH] added import np statements --- doc/modules/linear_model.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/doc/modules/linear_model.rst b/doc/modules/linear_model.rst index f243e5d8b077c..ecf2ca22a0a15 100644 --- a/doc/modules/linear_model.rst +++ b/doc/modules/linear_model.rst @@ -1073,6 +1073,7 @@ polynomial regression can be created and used as follows:: >>> from sklearn.preprocessing import PolynomialFeatures >>> from sklearn.linear_model import LinearRegression >>> from sklearn.pipeline import Pipeline + >>> import numpy as np >>> model = Pipeline([('poly', PolynomialFeatures(degree=3)), ... ('linear', LinearRegression(fit_intercept=False))]) >>> # fit to an order-3 polynomial data @@ -1098,6 +1099,7 @@ This way, we can solve the XOR problem with a linear classifier:: >>> from sklearn.linear_model import Perceptron >>> from sklearn.preprocessing import PolynomialFeatures + >>> import numpy as np >>> X = np.array([[0, 0], [0, 1], [1, 0], [1, 1]]) >>> y = X[:, 0] ^ X[:, 1] >>> X = PolynomialFeatures(interaction_only=True).fit_transform(X)