title: Scikit-learn tutorial gives me a depreciation error, how to update?
body: <p>I acquired a copy of <em>Mastering Machine Learning with scikit-learn</em>, and I began working through it. However, it seems that a good amount of the code is now outdated. </p>
  
  <p>The first code snippet in the book, </p>
  
  <pre><code>import matplotlib.pyplot as plt
  X = [[6], [8], [10], [14],   [18]]
  y = [[7], [9], [13], [17.5], [18]]
  plt.figure()
  plt.title('Pizza price plotted against diameter')
  plt.xlabel('Diameter in inches')
  plt.ylabel('Price in dollars')
  plt.plot(X, y, 'k.')
  plt.axis([0, 25, 0, 25])
  plt.grid(True)
  plt.show()
  </code></pre>
  
  <p>Ran just fine. However, when I moved on to the second one: </p>
  
  <pre><code>from sklearn.linear_model import LinearRegression
  # Training data
  X = [[6], [8], [10], [14],   [18]]
  y = [[7], [9], [13], [17.5], [18]]
  # Create and fit the model
  model = LinearRegression()
  model.fit(X, y)
  print 'A 12" pizza should cost: $%.2f' % model.predict([12])[0]
  </code></pre>
  
  <p>It gave me an error: </p>
  
  <pre><code> A 12-inch pizza should cost: $%.2f
   /home/dave/anaconda3/lib/python3.5/site-packages/sklearn/utils/validation.py:386: DeprecationWarning: Passing 1d arrays as data is deprecated in 0.17 and willraise ValueError in 0.19. Reshape your data either using X.reshape(-1, 1) if your data has a single feature or X.reshape(1, -1) if it contains a single sample.
     DeprecationWarning)
   Traceback (most recent call last):
     File "002----Chapter2-B.py", line 11, in &lt;module&gt;
       print ("A 12-inch pizza should cost: $%.2f") % model.predict([12])[0]
   TypeError: unsupported operand type(s) for %: 'NoneType' and 'float'
  </code></pre>
  
  <p>When it <em>should</em> have given me this:</p>
  
  <pre><code> A 12" pizza should cost: $13.68
  </code></pre>
  
  <p>Is there anyway to fix this?</p>