Loss or Cost Function | Deep Learning Tutorial 11 (Tensorflow Tutorial, Keras & Python)

แชร์
ฝัง
  • เผยแพร่เมื่อ 14 พ.ย. 2024

ความคิดเห็น • 106

  • @codebasics
    @codebasics  2 ปีที่แล้ว +2

    Check out our premium machine learning course with 2 Industry projects: codebasics.io/courses/machine-learning-for-data-science-beginners-to-advanced

  • @陳翰儒-d5m
    @陳翰儒-d5m 3 ปีที่แล้ว +17

    Man, I love this series.

    • @codebasics
      @codebasics  3 ปีที่แล้ว +1

      Glad you enjoyed it

  • @ashwin4991
    @ashwin4991 10 หลายเดือนก่อน +1

    Loving this series. You're so good at looking at everything from the learners perspective and clarifying everything! Much better than all the other tutorials I've tried

  • @viniciushedler3132
    @viniciushedler3132 3 ปีที่แล้ว +9

    When changing y_predicted to avoid errors with log(0) it is possible to do [ abs( y - epsilon ) for y in y_predicted ], which will work for both y=1 and y=0 cases

    • @satyarthpandey2941
      @satyarthpandey2941 2 ปีที่แล้ว +5

      if earlier, some y was epsilon(which is fine), then now it will become 0 from your function(which is a problem).

  • @BahauddinAziz
    @BahauddinAziz 3 ปีที่แล้ว +11

    Feedback: You can create chapter of the tutorials, will be helpful to navigate

    • @abikrsen3205
      @abikrsen3205 3 ปีที่แล้ว +1

      This video cannot have chapters since he's teaching the concept as a whole and not discrete things in the video that could be bookmarked like in other videos. 🙄

  • @mohitupadhayay1439
    @mohitupadhayay1439 2 ปีที่แล้ว

    That log loss vs MSE article was a BOOM!

  • @priyabratapanda1216
    @priyabratapanda1216 4 ปีที่แล้ว +4

    Sir in binary cross entropy the loss function should be c=-- 1/n sum (y*log(p) + (1-y)log(1-p))
    Where p is the probability of the sample for the positive class.
    By the way nice intuitive lectures ,I love you way of teaching 🙏

    • @rajdipdas1329
      @rajdipdas1329 2 ปีที่แล้ว +1

      yes it comes from bernoullie's theorem P(x)=p^x*(i-p)^n-x; after that if we take log on both side.

  • @sakalagamingyt3563
    @sakalagamingyt3563 5 หลายเดือนก่อน +1

    Instead of doing manually we can avoid log(0) using numpy:
    epsilon = 1e-15
    y_predicted_new = np.clip(y_predicted,epsilon,1-epsilon)

  • @meenakshichippa260
    @meenakshichippa260 ปีที่แล้ว +1

    U should not hesitate to mention Andrew NG 's name. We all learn from somebody. Andrew NG has his own expertise and u have ur own.
    It is always perfectly okay to share from sources we learn.

    • @codebasics
      @codebasics  ปีที่แล้ว +1

      Of course. I think pretty much all the people who know ML have learnt from Andrew NG at some point. I have a great admiration for him 👍🏼

  • @Reem.alhamimi
    @Reem.alhamimi หลายเดือนก่อน

    I can't thank you enough!!!! Thanks a lot for this Tremendous work

  • @pickase
    @pickase ปีที่แล้ว +2

    for real i really performed all those code without using your notebook sir because of the virus warning.😅😅

  • @mohdsyukur1699
    @mohdsyukur1699 7 หลายเดือนก่อน

    These series are the best

  • @ukanivikas2694
    @ukanivikas2694 4 ปีที่แล้ว +3

    Beautiful explaination ❤️

  • @GamerBoy-ii4jc
    @GamerBoy-ii4jc 2 ปีที่แล้ว

    it's very easy exercise i just replace the absolute with square and it done...thanks for this playlist

  • @maheshsingh2205
    @maheshsingh2205 2 ปีที่แล้ว

    Am just stuck with the series.. It's super interesting

  • @YoutuberEnjoy
    @YoutuberEnjoy ปีที่แล้ว +1

    Simply great💌

  • @manujarora5062
    @manujarora5062 2 ปีที่แล้ว +1

    at 17:32 the formula needs a parentheses to begin before yi and end at the end of expression.

    • @manujarora5062
      @manujarora5062 2 ปีที่แล้ว

      Here is my intuition for the scary looking Log loss formula
      Case 1: We predict perfectly
      As per formula if y is actually 0 and you predict 0 then the loss is 0. if y is actually 1 and you predict 1 then loss is 0
      Case 2: We predict with some errors
      If y was actually 0 then the first term is 0.
      The Second term is putting a very high penalty (exponentially higher) if you predict value closer to 1.
      The penalty would be infinite if your algorithm predicted a value of 1 when the actual was value was 0
      Vice versa also holds

  • @anjmuk79
    @anjmuk79 3 ปีที่แล้ว +2

    Thank you so much Sir.

  • @izharkhankhattak
    @izharkhankhattak 3 ปีที่แล้ว +1

    Great man does a great job. Thank you so much.

  • @nilupulperera
    @nilupulperera ปีที่แล้ว

    Great.Thank you very much

  • @abhishekfnu7455
    @abhishekfnu7455 2 ปีที่แล้ว

    Thank you so much for this course, sir

  • @karanveersingh1658
    @karanveersingh1658 ปีที่แล้ว

    min(i, 1 - epsilon) puts all values below even if it is above 1

  • @harshkartiksingh5356
    @harshkartiksingh5356 4 หลายเดือนก่อน +1

    i was frightened from that corona virus mate, it freaked me out😂😂,thanks for this awesome video.

  • @asamadawais
    @asamadawais 3 ปีที่แล้ว

    You are excellent boss. Allah bless you!

  • @udipfeffer9859
    @udipfeffer9859 ปีที่แล้ว +1

    Thank you for this very clear lesson. Is it possible that the "y_predicted" and "y_true" are confused?
    I would expect y_true to be in {0,1}, and y_predicted represent a probability in [0,1]

  • @jvedarutvija7517
    @jvedarutvija7517 2 ปีที่แล้ว

    Amazing tutorial :)

  • @abdallahlakkis449
    @abdallahlakkis449 ปีที่แล้ว

    Awesome content thanks a lot

    • @codebasics
      @codebasics  ปีที่แล้ว

      Glad you enjoyed it.

  • @leelavathigarigipati3887
    @leelavathigarigipati3887 4 ปีที่แล้ว +1

    Thank you so for the detailed explanation. Could you please explain about SGD, ADAM optimizations.

    • @codebasics
      @codebasics  4 ปีที่แล้ว +4

      I have a video coming up on SGD, batch and mini batch. It will be live today.i will add video on Adam too in future

    • @leelavathigarigipati3887
      @leelavathigarigipati3887 4 ปีที่แล้ว

      @@codebasics Thank you so Much 🙇

  • @SwarnaliMollickA
    @SwarnaliMollickA 2 ปีที่แล้ว

    You are rock🙏

  • @ronyjoseph7868
    @ronyjoseph7868 3 ปีที่แล้ว

    very benificial videos, can u upload videos of some online or offline job oppurtunities of machine, deep learning

  • @umarzia1985
    @umarzia1985 3 ปีที่แล้ว +2

    The tutorials are very helpful. Can we get ppt slides of the tutorials plz?

  • @ClasherSPOT
    @ClasherSPOT 3 หลายเดือนก่อน +2

    My Computer is infected with so many viruses. Help me

  • @দেবজিৎসরকার-ঢ৫ব
    @দেবজিৎসরকার-ঢ৫ব 2 ปีที่แล้ว

    Sir please make a course on deep learning and AI🙏🙏.please reply

  • @nirmesh44
    @nirmesh44 4 ปีที่แล้ว

    very nicely explained

  • @1bitmultiverse
    @1bitmultiverse 3 ปีที่แล้ว +1

    I have accidentally opened the solution file ... Now my computer is feeling fever and headache 😂 I think you were right... Now I need to get a vaccination for my computer, kindly make a tutorial for that too.... 😂 😂 😂

    • @codebasics
      @codebasics  3 ปีที่แล้ว +1

      Pfizer is still inventing the vaccination for the computer :)

    • @1bitmultiverse
      @1bitmultiverse 3 ปีที่แล้ว

      @codebasics but I want you to make a vaccine for my computer.... 😂😂 because you send this coronavirus in my computer or send me NVIDIA GeForce RTX 3070 ( Vaccine for my pc ) 😂😂 😂😂😂😂😂😂

  • @isaakimaliev5584
    @isaakimaliev5584 3 ปีที่แล้ว

    RuntimeWarning: divide by zero encountered in log

  • @bhamrags
    @bhamrags 3 ปีที่แล้ว

    Dhaval ji it would be better if you also explain if one get 'nan' error due to log(1-y_pred) part in log loss equation when (1-y_pred) value becomes 'negative' which is invalid value encountered in log. And How to resolve this issue?

  • @pardeepsangruri
    @pardeepsangruri 4 ปีที่แล้ว

    hi , i have a problem understanding the example in the sklearn documentation
    from sklearn.metrics import log_loss
    >>> log_loss(["spam", "ham", "ham", "spam"],
    ... [[.1, .9], [.9, .1], [.8, .2], [.35, .65]])
    0.21616...
    can you please explain this and extend the log_loss idea to multiclass classification. Where they take np.argmax of true_values and subtract the predicted.
    can you please make a video and expain this concept. Thanks a lot for making this great video

  • @dhirajkumarsahu999
    @dhirajkumarsahu999 3 ปีที่แล้ว

    Thank you for the video

  • @bilkisuismail6096
    @bilkisuismail6096 4 หลายเดือนก่อน

    I was wondering why we have 0.5 as a result for MAE with Python code and 0.26 with Numpy code

  • @sanooosai
    @sanooosai 10 หลายเดือนก่อน

    thank you

  • @Brian5094
    @Brian5094 ปีที่แล้ว

    Have a question, in 7:50 you mentioned that MAE is the cost function, but why in 1:05, you said it is loss function? Besides, in TF's parameter, should not the parameter "loss" should be "cost"? Because it is cost function not loss function?

  • @pratikbhansali4086
    @pratikbhansali4086 3 ปีที่แล้ว

    Pls add more videos of this Playlist sir

  • @gamesniper98
    @gamesniper98 ปีที่แล้ว

  • @faezeabdolinejad731
    @faezeabdolinejad731 3 ปีที่แล้ว

    😅😄you are cool, thank you

  • @aodhrinfo510
    @aodhrinfo510 3 ปีที่แล้ว

    you are such a great man 👨

  • @jntb3000
    @jntb3000 3 ปีที่แล้ว +1

    Thanks for the presentation.
    Small question: whereas y-hat is actual predicted result (fractional values) y seems to be from Step Function (ie, 0 or 1, not fractional value). Is this correct ?

  • @abhaydadhwal1521
    @abhaydadhwal1521 2 ปีที่แล้ว +2

    Sir, in Binary cross entropy ... won't the true value (y) create a problem if it is 1 ?.... because it makes the equation 0 as 1-1 = 0

    • @esraahamada4784
      @esraahamada4784 ปีที่แล้ว

      Yeah, I think y_true will make problem because if it's zero all the left portion will be ignored as it's doesn't exist and if it's 1 all the right portion will be ignored . Will that cause a problem I don't know but I think we lost a valuable information.

  • @abhisheknagar9000
    @abhisheknagar9000 4 ปีที่แล้ว

    Nice Explanation. Do we need to use Binary crossentropy in case of Binary classification only or can be used in Multi class classification?
    Also kindly explain about the sparse categorical entropy.

    • @codebasics
      @codebasics  4 ปีที่แล้ว +2

      In multi class classification we need to use categorical cross entropy or sparse categorical entropy. Yes I will cover difference among them in future videos

    • @vinaychitturi5183
      @vinaychitturi5183 3 ปีที่แล้ว

      @@codebasics Hi Sir, This is a nice explanation about MSE and MAE. Have you made video on Categorical cross entropy? Looking for this video. Thanks.

  • @Anonymous-md4ql
    @Anonymous-md4ql 3 ปีที่แล้ว

    Naively explained

  • @hamzakhurshed2650
    @hamzakhurshed2650 ปีที่แล้ว +7

    Your Virus came to my computer

    • @whoami-u9g
      @whoami-u9g หลายเดือนก่อน

      lol what?

  • @wildannasrullah61
    @wildannasrullah61 3 ปีที่แล้ว

    Do you have tutorial like this but for NCE Loss function? Thank you

  • @sourabhmaharajpet
    @sourabhmaharajpet 4 ปีที่แล้ว

    Guessing, is chance so on bases on chances the error should have been calculated

  • @ИванПетрович-г6ю
    @ИванПетрович-г6ю ปีที่แล้ว

    If log loss outputs the range from 0 to 1, why is your model giving values outside this range?

  • @testcode9589
    @testcode9589 3 ปีที่แล้ว

    why both np.sum(np.abs(y_predicted-y_true)) and np.mean(np.sum(np.abs(y_predicted-y_true))) have same result when i calculate on my own

  • @dsran6358
    @dsran6358 2 ปีที่แล้ว

    hi sir,when we are doing log loss function in that we are taking -np.mean(log function) but we didn't take n value hear -1/n ? at 22:37

  • @AkhileshShukla-d5x
    @AkhileshShukla-d5x ปีที่แล้ว

    Where can I get this PPT for my revision

  • @deepakhg2963
    @deepakhg2963 2 ปีที่แล้ว

    When i use tf.keras.metrics.binary_crossentropy, the result is different. please comment.

  • @deeptimaanbanerjee6330
    @deeptimaanbanerjee6330 3 ปีที่แล้ว

    Reflecting back, seems like many people clicked on the solution link without trying to solve for the answer themselves.

  • @udaybhaskargajavalli7684
    @udaybhaskargajavalli7684 4 ปีที่แล้ว

    Any tutorials on multiclass-multioutput regression or classification

    • @universe3603
      @universe3603 4 ปีที่แล้ว

      you mean classification?

  • @sarveshamrute2959
    @sarveshamrute2959 4 ปีที่แล้ว

    Hello sir.....I'm a beginner machine learning learner...I started learning it from your channel...but one of my friend suggested me to do the course of Machine Learning by andrew ng from coursera...but in that course..after linear and logistic regression, he has started directly teaching neural networks while in your playlist first all ml concepts are suggested as an prequisite. So what should I do...hope you clear my doubts asap....thnx

    • @codebasics
      @codebasics  4 ปีที่แล้ว +1

      Yes please follow my entire machine learning playlist. You need to have good understanding on basic machine learning models, train test split, k fold, GridsearchCV etc before you start deep learning. And I have covered all of that in my ML playlist

    • @sarveshamrute2959
      @sarveshamrute2959 4 ปีที่แล้ว

      Also he teaches in very deep...like mathematics and all as compared to you...so are your videos sufficient to do various projects?

    • @universe3603
      @universe3603 4 ปีที่แล้ว +1

      @@sarveshamrute2959 without ML u can't move smoothly in DL. If you dont have enough knowledge in ML algorithms you probably stuck everywhere in DL. Codebasics gives you an amazing grip in ML with awesome explanation as this video so you can implement any project smoothly. go to ml playlist now. i'm saying this with experience. and also he has discord server u can join there and get instant help from experts in ml and dl whenever u stuck. good luck

  • @abdulbasit.tech1
    @abdulbasit.tech1 4 ปีที่แล้ว

    why don't you change to value of y_true with epsilon when doing log loss function ?

    • @universe3603
      @universe3603 4 ปีที่แล้ว +1

      look at equation 16:42 there's no log for y_true. so no need to change it with epsilon

  • @duminda-kodagoda
    @duminda-kodagoda 3 ปีที่แล้ว

    Very nice video tutorial.. keep on doing this!!
    if predicted value is always 0 and 1 then following is easy right?
    y_predicted_new = [ abs(i-1e-15) for i in y_predicted ]

  • @SwarnaliMollickA
    @SwarnaliMollickA 2 ปีที่แล้ว

    MSE is 0.366

  • @mahmoudgadelrab5133
    @mahmoudgadelrab5133 6 หลายเดือนก่อน

    Nobel prize

  • @daljeetsinghranawat6359
    @daljeetsinghranawat6359 ปีที่แล้ว

    i am implimenting mini batch graddesc but y_predicted is very far from y_true..no matter how many epochs i try.....

  • @shaikansarbasha4169
    @shaikansarbasha4169 4 ปีที่แล้ว

    sir what is the difference between (math.e)**(-15) and 1e-15

    • @mikeminotakis9092
      @mikeminotakis9092 4 ปีที่แล้ว +1

      By math.e you call the Euler's number from math module in python so your example is (2.718281)**-15 whereas by 1e-15 you mean the scientific notation so it's 1 * 10**(-15).

    • @shaikansarbasha4169
      @shaikansarbasha4169 4 ปีที่แล้ว

      @@mikeminotakis9092 thank you anna

  • @shakib_04
    @shakib_04 3 ปีที่แล้ว +2

    poor corona virus :(

  • @raj345to
    @raj345to 2 ปีที่แล้ว

    sir please register a company and give us internship in a project. ready to pay you anything!!It will be an honour and privilege to work with you.

  • @adiflorense1477
    @adiflorense1477 3 ปีที่แล้ว

    6:29 Great content. sir, how can be like that y=0?

  • @24-7Pain
    @24-7Pain 4 ปีที่แล้ว

    Lmfao coronavirus solution! Just a quick question -> On the mean square error, what does n represent? is it the number of output nodes or the number of training samples in the dataset?

    • @qwantisheku7452
      @qwantisheku7452 4 ปีที่แล้ว

      The second one. If your dataset has 30 records, so it will be 1/30*Loss

  • @MohamedAshraf-zs6nv
    @MohamedAshraf-zs6nv 3 ปีที่แล้ว

    point nineninenineninenineninenine

  • @thinhnguyen8158
    @thinhnguyen8158 9 หลายเดือนก่อน

    dcmm

  • @ashvinikumardongre9330
    @ashvinikumardongre9330 2 ปีที่แล้ว

    Sir, can we have more clarification on the terminiologies we use?initially you said individual error is called loss and cumulative error is called cost function. which means MSE and MEA should be called as cost function and not loss but later in the model you put loss = 'mean-squared-error'. Shouldn't it be costfunction = 'mean-squared-error'
    Obviously 'loss' must be a keyword used by tensorflow, so should we assume that every thing(absolute error, MAE, MSE, log loss) can be called as 'loss' or 'cost' or 'loss function' or 'cost function' interchangeably?? if so then why should we differentiate between loss and cost function at all?? @codebasics

    • @_RMSG_
      @_RMSG_ 2 ปีที่แล้ว

      Loss and cost are used interchangeably in machine learning

  • @advertisemedia1509
    @advertisemedia1509 ปีที่แล้ว

    np.absy_predicted - y_true)
    ----> 4 np.absolute(y_predicted - y_true)
    ValueError: operands could not be broadcast together with shapes (5,) (6,)

  • @vishaljaiswar6441
    @vishaljaiswar6441 2 ปีที่แล้ว

    Amazing tutorial :)

  • @EarlWallaceNYC
    @EarlWallaceNYC 3 ปีที่แล้ว

    thanks for the video