title: Coefficient of determination is different between scikit-learn and scipy libraries. why?
body: <p>I have a dataset from a paper and I am having a hard time verifying their reported coefficient of determination, R-squared. I used sklearn and scipy libraries and im getting different answers. why? which one is more reliable?
  p.s. when I used Excel as another alternative I got the same answer as from scipy.</p>
  
  <p>Below is the code I used to compare the results from SKlearn and Scipy:</p>
  
  <pre><code>import pandas as pd
  from scipy import stats
  from sklearn.metrics import r2_score
  
  data = pd.read_csv("output.csv", header=None)
  
  y_measured = data.iloc[0, :].values
  y_predicted = data.iloc[1, :].values
  
  print(r2_score(y_measured, y_predicted)) # prints 0.708717556205
  
  slope, intercept, r_value, p_value, std_err = stats.linregress(y_measured, y_predicted)
  
  print(r_value**2)  # prints 0.731889173485
  </code></pre>