Considering your question I guess for a linear regression model is it pretty okay. Much higher accuracy is probably not possible with LR. Other ml models would have to be taken into consideration
@@pythonmaraton I am still having the same problem. I used the LR = LinearRegression code, but still just returning LinearRegression() when I run the next line of code.
Very clear video thanks a lot. One questions I have is why do we need to reshape the data ? And why do we need to use .values? Wouldn't it work if we just used X_train, Y_train instead of X_train.values ?
The reason is essentially because of the datatype. It needs to be in nd array form and needs to be a 2d array. you will get an error if you try to just use X_train because at this point it is a series datatype. You can convert it to a numpy.ndarray by using X_train = X_train.to_numpy() and then reshape to (-1, 1) OR you can just take the values stored in the series and reshape the values directly to (-1, 1). I think this is because the lr.fit() function takes only 2d arrays, not series. Hope that helps!
The accuracy of this particular model over this data is pretty good (~40%). The linear model is pretty good at catching the general (linear) trend of the datapoints. But it will be difficult to improve the accuracy with this model, as the datapoints are distributed with a wide variance around the linear model. Other regressors could be more accurate.
Thanks for the video. Just to make a contribution, there is an outlier with high leverage in the training set (the observation with coordinates around (100, 35)). This is affecting the estimation of the slope coefficient, making its estimated value smaller than it should be. As a result, the estimated line does not fit the testing set well. There are no outliers in the testing set. Thanks again. Cheers.
Hi, thanks for the question. Sklearn wants the arrays to be vertical. The -1,1 is just a shortcut to flip it vertical. It’s like saying reshape to size N,1 (N rows and 1 column). Likewise if you reshape to (1,-1) it would reshape to size 1,N (1 row and N columns)
@@pythonmaraton Exactly man.... Would u mind telling me the name of the chrome plugin or if possible sending the link of the chrome plugin!!?? Thanks for reply by the way..
How do you make their values appear normal again after running the model? Like for example: I had a value of 3070.55 then after processing the data, the machine made the value from 3070.55 to 7.189879, then after running the model i get 0.46598782 on mean square error and 0.47839596 for cross validation score. How do i return the value of 7.189879 to original 3070.55 so that i can output the value to original amount?
looks good and it helped me a lot. I did this for a class project a few months ago but it was a great refresher. a question, if i wanted to plug my predictions back into the actual data - to for example tie the prediction to a womans name if it existed in the original data set; how would we do that?
Ryan, thanks for the great video. Do you happen to know why am I getting the fit error ValueError: Input contains NaN, infinity or a value too large for dtype('float64').
I tried installing then importing sklearn but Python didn't recognize it. I had to install skicit-learn instead. # Go to File -> Settings -> Python Interpeter and install pydataset and scikit-learn packages # scikit-learn is called sklearn when using the import statement from sklearn.linear_model import LinearRegression # For linear regression from sklearn.model_selection import train_test_split # To split data into train and test
No, not a good model as its 39% accurate, ideally you want it in the 3/4 mark or more (75% accuracy) for it to be an okish model and 90% or more for it to be brilliant
Mi loco, no se si entiendas; pero tu video salvo mi ser, eres grande
An awesome video and great explanation. Why it ain't got any views i wonder!!!! Thanks a lot!!
At 3.32, what was the reshaping criteria: why reshaped to (-1,1) and not anything else? I didn't understand that part.
Considering your question I guess for a linear regression model is it pretty okay. Much higher accuracy is probably not possible with LR. Other ml models would have to be taken into consideration
very helpful, thank you!!! I can finally do my HW after watching this video!
can anyone explain 3:40? I couldnt get the output[7], my output was just LinearRegression() and due to that I couldn't further use the .predict either
@@pythonmaraton I am still having the same problem. I used the LR = LinearRegression code, but still just returning LinearRegression() when I run the next line of code.
@@Continentalky Did you find a solution I am having the exact same issue?
Thanks bro. I already got subscribed and no doubt I will watch all your videos as you are a great teacher. God bless you!
i think it was a great model and u are aa great person tysm for making this vid
thanks. this helps me to do a data science assignment
Great Tutorial. Thanks
Very clear video thanks a lot.
One questions I have is why do we need to reshape the data ? And why do we need to use .values? Wouldn't it work if we just used X_train, Y_train instead of X_train.values ?
That's what I want to know too
The reason is essentially because of the datatype. It needs to be in nd array form and needs to be a 2d array. you will get an error if you try to just use X_train because at this point it is a series datatype. You can convert it to a numpy.ndarray by using X_train = X_train.to_numpy() and then reshape to (-1, 1) OR you can just take the values stored in the series and reshape the values directly to (-1, 1). I think this is because the lr.fit() function takes only 2d arrays, not series. Hope that helps!
Thank you so much. I learned a lot.
The accuracy of this particular model over this data is pretty good (~40%). The linear model is pretty good at catching the general (linear) trend of the datapoints. But it will be difficult to improve the accuracy with this model, as the datapoints are distributed with a wide variance around the linear model. Other regressors could be more accurate.
Is the score the R2?
Thanks for the video. Just to make a contribution, there is an outlier with high leverage in the training set (the observation with coordinates around (100, 35)). This is affecting the estimation of the slope coefficient, making its estimated value smaller than it should be. As a result, the estimated line does not fit the testing set well. There are no outliers in the testing set. Thanks again. Cheers.
Nice video! Short and crisp.
Love it 🥰🔥
Great video, you've explained it nicely. Thanks!!
is the fit() function did all the training job? why is so quick?
gracias por existir
@Python Marathoón: can you explain the reshape? Is it just the selection of 2 features from possibly more features? Why -1?
Hi, thanks for the question. Sklearn wants the arrays to be vertical. The -1,1 is just a shortcut to flip it vertical. It’s like saying reshape to size N,1 (N rows and 1 column). Likewise if you reshape to (1,-1) it would reshape to size 1,N (1 row and N columns)
@@pythonmaraton thanks, that explains it. Great video!
thanks Rylan you are awesome dude !
*Thank you, man. I understood.*
hey, I just love to work in a dark background. How did you make your background dark... ??
@@pythonmaraton Exactly man.... Would u mind telling me the name of the chrome plugin or if possible sending the link of the chrome plugin!!?? Thanks for reply by the way..
@@pythonmaraton Thank you so much man. Your tutorial was also awesome!!
At 4:00 what if we don't reshape?
@@pythonmaraton 👍
how to find dataset
How do you make their values appear normal again after running the model?
Like for example:
I had a value of 3070.55 then after processing the data, the machine made the value from 3070.55 to 7.189879, then after running the model i get 0.46598782 on mean square error and
0.47839596 for cross validation score.
How do i return the value of 7.189879 to original 3070.55 so that i can output the value to original amount?
looks good and it helped me a lot. I did this for a class project a few months ago but it was a great refresher. a question, if i wanted to plug my predictions back into the actual data - to for example tie the prediction to a womans name if it existed in the original data set; how would we do that?
ModuleNotFoundError: No module named 'pydataset'
pip install pydataset
Bruh
Great video. To answer your question, since the model scored under 70% wouldn't it be considered poor performance?
I think it depends because if you are going to predict the percentage of people surviving after an operation, 70 might be a low number.
is there a way to predict "x" using a specific "y" value?
I mean just feed y instead of x into the model
That was great. Thank you!
how to get this dataset?
Thanks bro
Ryan, thanks for the great video.
Do you happen to know why am I getting the fit error
ValueError: Input contains NaN, infinity or a value too large for dtype('float64').
My model score is very low, but the predictions are very close. Interesting.
Extreme outliers?
how to import pydataset in jupyter notebook?
i am working on an excel file but I get key error for 'height' which is the first column in my data.
The notebook can we have the code?
I tried installing then importing sklearn but Python didn't recognize it. I had to install skicit-learn instead.
# Go to File -> Settings -> Python Interpeter and install pydataset and scikit-learn packages
# scikit-learn is called sklearn when using the import statement
from sklearn.linear_model import LinearRegression # For linear regression
from sklearn.model_selection import train_test_split # To split data into train and test
Sometimes a less accurate but simpler model is better to get others "buy in". I guess that one can need some help though.
I am getting an error: fit() missing 1 required positional argument: 'y'
Any suggestions on removing this?
@@pythonmaraton Could you help me understand why the reshape is important and what it's doing?
yo, good succint video. thanks
Bhai mera to nhi ho rha... mene code type kiya jaisa aapne likha vese copy paste lekin vo error dera
My score is coming 0.0348.Am I still correct?Since I have done all the steps same
No, not a good model as its 39% accurate, ideally you want it in the 3/4 mark or more (75% accuracy) for it to be an okish model and 90% or more for it to be brilliant
Plz aapka koi contact hoto mujhe dede
at least do something to improve ur model 0.3 R is very low