title: Sklearn NotFittedError: This LinearRegression instance is not fitted yet
body: <p>I am trying a simple linear regression and I have tried this code:</p>
  
  <pre><code>x1=data.iloc[:, 9].values
  y1=data.iloc[:,1].values
  
  from sklearn.model_selection import train_test_split
  seed=7
  x1_train,x1_test,y1_train,y1_test= 
  train_test_split(x1,y1,test_size=0.15,random_state=seed)
  
  x1_train=nm.reshape(nm.array(x1_train),(-1,1))
  
  from sklearn.linear_model import LinearRegression
  lireg=LinearRegression()
  model1=LinearRegression().fit(x1_train,y1_train)
  
  y_pred=lireg.predict(x1_test)
  </code></pre>
  
  <blockquote>
    <p>NotFittedError: This LinearRegression instance is not fitted yet. Call 'fit' with appropriate arguments before using this method</p>
  </blockquote>
  
  <p>Please help</p>