title: ValueError: shapes (100,1) and (2,1) not aligned: 1 (dim 1) != 2 (dim 0)
body: <p>I used the following code for a machine learning problem, which I ended up to the error <code>ValueError: shapes (100,1) and (2,1) not aligned: 1 (dim 1) != 2 (dim 0)</code></p>
  <p>I found some similar topics, but actually, I could not find what is the main problem and how I can fix that. I transform the inputs as a NumPy array with a single column.</p>
  <pre><code>import numpy as np
  import pandas as pd
  from sklearn.model_selection import train_test_split
  from sklearn.linear_model import LinearRegression
  from sklearn.preprocessing import PolynomialFeatures
  
  np.random.seed(0)
  n = 15
  x = np.linspace(0,10,n) + np.random.randn(n)/5
  y = np.sin(x)+x/6 + np.random.randn(n)/10
  X_train, X_test, y_train, y_test = train_test_split(x, y, random_state=0)
  
  def regressor():
     
      X_test_new=np.linspace(0,10,100).reshape(100,1)
      prediction=np.array([])
       
      for i in [1,3,6,9]:    
          poly = PolynomialFeatures(degree=i)
          X_train_poly = poly.fit_transform(X_train.reshape(11,1))
          linreg = LinearRegression().fit(X_train_poly, y_train.reshape(11,1))
          prediction = np.concatenate((prediction,linreg.predict(X_test_new)),axis=0)
       
      return prediction
  regressor()
  </code></pre>