title: How to extract equation from a polynomial fit?
body: <p>My goal is to fit some data to a polynomial function and obtain the actual equation including the fitted parameter values. </p>
  
  <p>I adapted <a href="http://scikit-learn.org/stable/auto_examples/linear_model/plot_polynomial_interpolation.html" rel="noreferrer">this example</a> to my data and the outcome is as expected. </p>
  
  <p>Here is my code:</p>
  
  <pre><code>import numpy as np
  import matplotlib.pyplot as plt
  
  from sklearn.linear_model import Ridge
  from sklearn.preprocessing import PolynomialFeatures
  from sklearn.pipeline import make_pipeline
  
  
  x = np.array([0., 4., 9., 12., 16., 20., 24., 27.])
  y = np.array([2.9,4.3,66.7,91.4,109.2,114.8,135.5,134.2])
  
  x_plot = np.linspace(0, max(x), 100)
  # create matrix versions of these arrays
  X = x[:, np.newaxis]
  X_plot = x_plot[:, np.newaxis]
  
  plt.scatter(x, y, label="training points")
  
  for degree in np.arange(3, 6, 1):
      model = make_pipeline(PolynomialFeatures(degree), Ridge())
      model.fit(X, y)
      y_plot = model.predict(X_plot)
      plt.plot(x_plot, y_plot, label="degree %d" % degree)
  
  plt.legend(loc='lower left')
  
  plt.show()
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/PLZTI.png" rel="noreferrer"><img src="https://i.stack.imgur.com/PLZTI.png" alt="enter image description here"></a></p>
  
  <p>However, I now don't know where to extract the actual equation and fitted parameter values for the respective fits. Where do I access the actual fitted equation?</p>
  
  <p>EDIT:</p>
  
  <p>The variable <code>model</code> has the following attributes:</p>
  
  <pre><code>model.decision_function  model.fit_transform      model.inverse_transform  model.predict            model.predict_proba      model.set_params         model.transform          
  model.fit                model.get_params         model.named_steps        model.predict_log_proba  model.score              model.steps
  </code></pre>
  
  <p><code>model.get_params</code> does not store the desired parameters. </p>