title: Getting the ValueError: Found input variables with inconsistent numbers of samples: [248, 1239] while trying to run Adjt. R Squared and RMSE
body: <p>I'm new to the Data Science and to Random Forest, of course, I've been trying to find <strong>Adjusted R squared</strong> and <strong>RMSE</strong> after applying Random Forest on a Dataset of (1239, 29).</p>
  <pre><code>import matplotlib.pyplot as plt 
  import pandas as pd
  import numpy as np
  from sklearn.metrics import mean_squared_error, mean_squared_log_error, mean_absolute_error
  from sklearn.model_selection import train_test_split
  X = df.loc[:, df.columns != 'PRODUCTMONTHLYREVENUE_LINE']
  y = df.loc[:,['PRODUCTMONTHLYREVENUE_LINE']].values
  X_train, X_test, y_train, y_test = train_test_split(X, y, test_size = 0.2, random_state = 1)
  </code></pre>
  <p>I have applied Test Train before applying Random Forest on the dataset.</p>
  <pre><code>from sklearn.ensemble import RandomForestRegressor
  from sklearn.metrics import roc_auc_score
  model = RandomForestRegressor(oob_score=True)
  model.fit(X_train, y_train)
  y_predict=model.predict(X_test)
  </code></pre>
  <p>Now When I try to run RMSE I'm getting Errors which I was not getting in OLS model.</p>
  <pre><code>RMSE= np.sqrt(mean_squared_error(y_predict,y))
  RMSE
  </code></pre>
  <p><strong>Getting the below error</strong>
  ValueError                                Traceback (most recent call last)
   in ()
  ----&gt; 1 RMSE= np.sqrt(mean_squared_error(y_predict,y))
  2 RMSE</p>
  <p>2 frames
  /usr/local/lib/python3.6/dist-packages/sklearn/utils/validation.py in check_consistent_length(*arrays)
  210     if len(uniques) &gt; 1:
  211         raise ValueError(&quot;Found input variables with inconsistent numbers of&quot;
  --&gt; 212                          &quot; samples: %r&quot; % [int(l) for l in lengths])
  213
  214</p>
  <p>ValueError: Found input variables with inconsistent numbers of samples: [248, 1239]</p>