-
-
Notifications
You must be signed in to change notification settings - Fork 26k
8000
On master,
import numpy as np
from sklearn.preprocessing import SplineTransformer
X = np.linspace(0, 1, 10)[:, None]
splt = SplineTransformer(
knots=[[0], [1], [2], [3], [4]],
n_knots=None,
degree=3
)
splt.fit(X)
currently raises
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-5-86bffa93d84e> in <module>
10 )
11
---> 12 splt.fit(X)
~/code/scikit-learn/sklearn/preprocessing/_polynomial.py in fit(self, X, y)
226 isinstance(self.n_knots, numbers.Integral) and self.n_knots >= 2
227 ):
--> 228 raise ValueError("n_knots must be a positive integer >= 2.")
229
230 if isinstance(self.knots, str) and self.knots in [
ValueError: n_knots must be a positive integer >= 2.
IMO the n_knots
argument should be allowed to be None
(or any other value) if the knots
are passed explicity.
cc: @lorentzenchr @ogrisel
xref #18368 and #19483