Skip to content

Commit

Permalink
added import np statements
Browse files Browse the repository at this point in the history
  • Loading branch information
CaMeLCa5e committed Mar 31, 2015
1 parent 22963a0 commit 9e7a660
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions doc/modules/linear_model.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
Expand Down

0 comments on commit 9e7a660

Please sign in to comment.