Wai Yin Mok 0 Posted April 14, 2020 Report Share Posted April 14, 2020 Hello w3schools, I was using your site https://www.w3schools.com/python/python_ml_linear_regression.asp to teach Linear Regression today (4/14/2020). On this web page, it says slope, intercept, r, p, std_err = stats.linregress(x, y) and r is the r-squared value returned from the method scipy.stats.linregress(x, y). It is not. I checked https://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.linregress.html about the method scipy.stats.linregress. r is the correlation coefficient of the data sets x and y, which ranges from -1 to 1. Your web page says r-squared value ranges from 0 to 1. One of your examples https://www.w3schools.com/python/trypython.asp?filename=demo_ml_r_squared contradicts this assertion. The returned value is -0.758591524376155, which is out of the range of r-squared. In fact, r-squared = (correlation coefficient)^2. Please correct this mistake. Thank you Wai Yin Mok Quote Link to post Share on other sites
Ingolme 1,027 Posted April 15, 2020 Report Share Posted April 15, 2020 The W3Schools staff generally don't visit the forums, but they provide an email address where you can indicate problems with the site: help@w3schools.com You can find this email address on any page by clicking the "REPORT ERROR" link at the bottom of the page. Quote Link to post Share on other sites
Wai Yin Mok 0 Posted April 15, 2020 Author Report Share Posted April 15, 2020 Thank you for the pointer. Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.