Linear Regression Python Sklearn [FROM SCRATCH]

Поделиться
HTML-код
  • Опубликовано: 25 дек 2024

Комментарии • 68

  • @joseordonez7738
    @joseordonez7738 2 года назад

    Mi loco, no se si entiendas; pero tu video salvo mi ser, eres grande

  • @shrishsharma8333
    @shrishsharma8333 4 года назад +6

    An awesome video and great explanation. Why it ain't got any views i wonder!!!! Thanks a lot!!

  • @dome8116
    @dome8116 5 лет назад +12

    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

  • @paarthmadan1315
    @paarthmadan1315 4 года назад +7

    At 3.32, what was the reshaping criteria: why reshaped to (-1,1) and not anything else? I didn't understand that part.

  • @bradwang3648
    @bradwang3648 3 года назад +2

    very helpful, thank you!!! I can finally do my HW after watching this video!

  • @edson_winner
    @edson_winner 3 года назад +1

    Thanks bro. I already got subscribed and no doubt I will watch all your videos as you are a great teacher. God bless you!

  • @akshatbhadani1710
    @akshatbhadani1710 Год назад

    i think it was a great model and u are aa great person tysm for making this vid

  • @jaywiji
    @jaywiji 4 года назад +11

    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 ?

    • @wobblyjelly345
      @wobblyjelly345 3 года назад +1

      That's what I want to know too

    • @amikhalsa3173
      @amikhalsa3173 3 года назад +9

      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!

  • @michaelcstorm3808
    @michaelcstorm3808 3 года назад +1

    thanks. this helps me to do a data science assignment

  • @gnanashrishetty1465
    @gnanashrishetty1465 3 года назад +2

    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

    • @Continentalky
      @Continentalky 3 года назад +1

      @@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.

    • @theh1ve
      @theh1ve 2 года назад

      @@Continentalky Did you find a solution I am having the exact same issue?

  • @jeandy4495
    @jeandy4495 Год назад +1

    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.

  • @mridulagarwal5881
    @mridulagarwal5881 4 года назад

    Nice video! Short and crisp.

  • @jongcheulkim7284
    @jongcheulkim7284 3 года назад +1

    Thank you so much. I learned a lot.

  • @hudsontorrent6672
    @hudsontorrent6672 2 года назад

    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.

  • @deekshantchoudhary8454
    @deekshantchoudhary8454 4 года назад +1

    Great video, you've explained it nicely. Thanks!!

  • @abhishekambawale7456
    @abhishekambawale7456 Год назад

    Great Tutorial. Thanks

  • @skhdukes1888
    @skhdukes1888 4 года назад +3

    Great video. To answer your question, since the model scored under 70% wouldn't it be considered poor performance?

    • @farelferdinand1089
      @farelferdinand1089 3 года назад +1

      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.

  • @alokeveer
    @alokeveer 4 года назад +4

    hey, I just love to work in a dark background. How did you make your background dark... ??

    • @alokeveer
      @alokeveer 4 года назад

      @@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..

    • @alokeveer
      @alokeveer 4 года назад

      @@pythonmaraton Thank you so much man. Your tutorial was also awesome!!

  •  4 года назад +3

    Is the score the R2?

  • @spitfirelast8761
    @spitfirelast8761 3 года назад +1

    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?

  • @muhammadhamza7369
    @muhammadhamza7369 2 года назад

    Love it 🥰🔥

  • @toihirhalim
    @toihirhalim 4 года назад

    thanks Rylan you are awesome dude !

  • @aravindkramesh
    @aravindkramesh 2 года назад

    *Thank you, man. I understood.*

  • @Huy-G-Le
    @Huy-G-Le 3 года назад +4

    ModuleNotFoundError: No module named 'pydataset'

  • @ced4030
    @ced4030 4 года назад +2

    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?

  • @gongjiaji2489
    @gongjiaji2489 4 года назад

    is the fit() function did all the training job? why is so quick?

  • @Olivander-u9k
    @Olivander-u9k 3 года назад +1

    is there a way to predict "x" using a specific "y" value?

    • @aadhuu
      @aadhuu Год назад

      I mean just feed y instead of x into the model

  • @hannesvideo
    @hannesvideo Год назад

    @Python Marathoón: can you explain the reshape? Is it just the selection of 2 features from possibly more features? Why -1?

    • @pythonmaraton
      @pythonmaraton  Год назад +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)

    • @hannes672
      @hannes672 Год назад

      @@pythonmaraton thanks, that explains it. Great video!

  • @jaymanhire
    @jaymanhire 2 года назад

    My model score is very low, but the predictions are very close. Interesting.

  • @ricardosalas7048
    @ricardosalas7048 4 года назад +3

    gracias por existir

  • @jeffgalef121
    @jeffgalef121 4 года назад

    That was great. Thank you!

  • @sachindilhan7504
    @sachindilhan7504 3 года назад +1

    how to find dataset

  • @imtiazsajwani4239
    @imtiazsajwani4239 2 года назад

    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').

  • @ishikakesarwani6278
    @ishikakesarwani6278 3 года назад

    At 4:00 what if we don't reshape?

  • @prateekyadav7679
    @prateekyadav7679 4 года назад

    i am working on an excel file but I get key error for 'height' which is the first column in my data.

  • @afifkhaja
    @afifkhaja 2 года назад

    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

  • @ibrahimnadeem1064
    @ibrahimnadeem1064 Год назад

    how to get this dataset?

  • @prafuldhakde3601
    @prafuldhakde3601 10 месяцев назад

    Bhai mera to nhi ho rha... mene code type kiya jaisa aapne likha vese copy paste lekin vo error dera

  • @mandalamtarun5414
    @mandalamtarun5414 4 года назад

    I am getting an error: fit() missing 1 required positional argument: 'y'
    Any suggestions on removing this?

    • @zackmorey
      @zackmorey 4 года назад

      @@pythonmaraton Could you help me understand why the reshape is important and what it's doing?

  • @yeahjustlikethat
    @yeahjustlikethat 3 года назад

    Sometimes a less accurate but simpler model is better to get others "buy in". I guess that one can need some help though.

  • @oddnumber8149
    @oddnumber8149 3 года назад

    how to import pydataset in jupyter notebook?

  • @raminlakin7888
    @raminlakin7888 2 года назад

    The notebook can we have the code?

  • @sanketchore657
    @sanketchore657 4 года назад +1

    Thanks bro

  • @vasudhashrikhandey2194
    @vasudhashrikhandey2194 4 года назад

    My score is coming 0.0348.Am I still correct?Since I have done all the steps same

  • @crazycxr
    @crazycxr 3 года назад

    yo, good succint video. thanks

  • @devilzwishbone
    @devilzwishbone 3 года назад

    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

  • @ihsanayyach3696
    @ihsanayyach3696 2 года назад

    at least do something to improve ur model 0.3 R is very low

  • @prafuldhakde3601
    @prafuldhakde3601 10 месяцев назад

    Plz aapka koi contact hoto mujhe dede