title: PolynomialFeatures sklearn
body: <p>Here is my code:</p>
  
  <pre><code>import numpy as np
  from sklearn.preprocessing import PolynomialFeatures
  from sklearn.linear_model import LinearRegression
  from sklearn.pipeline import make_pipeline
  X_arr = []
  Y_arr = []
  with open('input.txt') as fp:
      for line in fp:
          b = line.split("|")
          x,y = b
          X_arr.append(int(x))
          Y_arr.append(int(y))
  
  
  X=np.array([X_arr]).T
  print(X)
  y=np.array(Y_arr)
  print(y)
  model = make_pipeline(PolynomialFeatures(degree=2),  
  LinearRegression(fit_intercept = False))
  model.fit(X,y)
  X_predict = np.array([[3]])
  print(model.predict(X_predict))
  </code></pre>
  
  <p>Please, i have a question about:</p>
  
  <pre><code>model = make_pipeline(PolynomialFeatures(degree=2),  
  </code></pre>
  
  <p>Please, how can i choose this value (2 or 3 or 4 etc.) ? is there a method to set this value dynamically ?</p>
  
  <p>For example, i have this file of test:</p>
  
  <pre><code> 1  1
   2  4
   4  16
   5  75
  </code></pre>
  
  <p>for the first three lines the model is </p>
  
  <pre><code>y=a*x*x+b*x + c (b=c=0)
  </code></pre>
  
  <p>for the last line, the model is:</p>
  
  <pre><code>y=a*x*x*x+b*x+c (b=c=0) 
  </code></pre>