ROC Curve & Area Under Curve (AUC) with R - Application Example

Provides easy to apply example obtaining ROC curve and AUC using R.
Data: github.com/bkrai/R-files-from...
Timestamps:
00:00 Introduction - ROC Curve & Model Evaluation with R
00:58 Logistic Regression Model
01:26 Confusion Matrix Misclassification Error
04:23 Model Performance
08:54 Identifying Best Cutoff and Frequency
12:51 ROC Curve
17:11 Area Under Curve (AUC)
Includes an example with,
- rocr package
- accuracy versus cutoff curve
- identifying best cutoff values for best accuracy
- true positive rate (tpr) or sensitivity
- false positive rate (fpr) or '1-specificity'
roc curve is an important model evaluation tool related to analyzing big data or working in data science field.
Machine Learning videos: goo.gl/WHHqWP
Becoming Data Scientist: goo.gl/JWyyQc
Introductory R Videos: goo.gl/NZ55SJ
Deep Learning with TensorFlow: goo.gl/5VtSuC
Image Analysis & Classification: goo.gl/Md3fMi
Text mining: goo.gl/7FJGmd
Data Visualization: goo.gl/Q7Q2A8
Playlist: goo.gl/iwbhnE
R is a free software environment for statistical computing and graphics, and is widely used by both academia and industry. R software works on both Windows and Mac-OS. It was ranked no. 1 in a KDnuggets poll on top languages for analytics, data mining, and data science. RStudio is a user friendly environment for R that has become popular.

Пікірлер: 501

  • @kaduflutist
    @kaduflutist2 жыл бұрын

    Excellent, Sir! Thanks a lot for bringing it so straightforward and consistently. For the first time, I could understand and reproduce the whole thing in r, regarding ROC Curve and AUC.

  • @bkrai

    @bkrai

    2 жыл бұрын

    You are most welcome!

  • @johnwilliammeyer6592
    @johnwilliammeyer65926 жыл бұрын

    Unbelievably helpful video - I've been searching all over internet for this. Thank you.

  • @bkrai

    @bkrai

    6 жыл бұрын

    That's good to know!

  • @TH-fe1vs
    @TH-fe1vs7 жыл бұрын

    thank you Sir, very kind of you to send the R code and the data, appreciate it. Your youtube here explains those concepts of ROC and AUC clearly, with a simple example. Well done.

  • @bkrai

    @bkrai

    7 жыл бұрын

    Thanks!

  • @duleepaj
    @duleepaj6 жыл бұрын

    Short, simple and covers everything! Thank you!

  • @bkrai

    @bkrai

    6 жыл бұрын

    Thanks for comments!

  • @aaradhyaabhijitshetti3933
    @aaradhyaabhijitshetti39334 жыл бұрын

    Sir... your explanation of ROC and AUC was very simple and easy to understand .Its cleared my all doubts..Thanks a lot...

  • @bkrai

    @bkrai

    4 жыл бұрын

    You are most welcome!

  • @KR-good
    @KR-good7 жыл бұрын

    This was an amazingly clear approach. Thank you.

  • @bkrai

    @bkrai

    7 жыл бұрын

    Great to hear your feedback!

  • @FOR4MUSIC
    @FOR4MUSIC6 жыл бұрын

    it is very clear you know what you are doing.Thank you for your contribution !

  • @bkrai

    @bkrai

    6 жыл бұрын

    Thanks for your feedback!

  • @vijaymore1239
    @vijaymore12396 жыл бұрын

    Thank you so much for explaining in much much simpler way!!!!!

  • @bkrai

    @bkrai

    6 жыл бұрын

    Thanks for your comments!

  • @getugamo7051
    @getugamo70513 жыл бұрын

    Very clear and impressive lecture! Thanks so much!

  • @bkrai

    @bkrai

    3 жыл бұрын

    You're very welcome!

  • @freddyflores6608
    @freddyflores66086 жыл бұрын

    Thank you so much for your explanation, I could run my code and understand better the process.

  • @bkrai

    @bkrai

    6 жыл бұрын

    Thanks for the feedback!

  • @kalyanasundaramsp8267
    @kalyanasundaramsp82676 жыл бұрын

    superb sir...phenomenal.....u make tough things look simple....proud of you boss

  • @bkrai

    @bkrai

    6 жыл бұрын

    Thanks!

  • @Revboiuk09
    @Revboiuk095 жыл бұрын

    Thanks a lot sir... for such precise explanation of AU ROC curve. Truly appreciated.!

  • @bkrai

    @bkrai

    5 жыл бұрын

    Thanks for comments!

  • @parasrai145
    @parasrai1456 жыл бұрын

    Great video and very well explained!

  • @bkrai

    @bkrai

    6 жыл бұрын

    Thanks for comments!

  • @danielsaphir8596
    @danielsaphir85964 жыл бұрын

    Yo that beat in the beginning was fire

  • @bkrai

    @bkrai

    4 жыл бұрын

    Thanks :)

  • @OrcaChess
    @OrcaChess5 жыл бұрын

    A ROC Curve Tutorial for more than two classes with the 1 vs ALL approach would be a very helpful video :).

  • @bkrai

    @bkrai

    5 жыл бұрын

    Thanks foe the suggestion, its on my list now.

  • @miguelsuarez475
    @miguelsuarez4756 жыл бұрын

    You nailed it teacher..!!

  • @bkrai

    @bkrai

    3 жыл бұрын

    Thanks!

  • @BeKindPlox
    @BeKindPlox6 жыл бұрын

    Great explanation!

  • @bkrai

    @bkrai

    6 жыл бұрын

    Thanks!

  • @jaituteja88
    @jaituteja886 жыл бұрын

    Great explanation. Thank you Sir! )

  • @bkrai

    @bkrai

    3 жыл бұрын

    Welcome!

  • @humbertobarino578
    @humbertobarino5785 жыл бұрын

    very very helpfull !!! im sending to some brazilians friends

  • @bkrai

    @bkrai

    5 жыл бұрын

    Thanks and hope you find other videos helpful too!

  • @edneideramalho2363
    @edneideramalho23635 жыл бұрын

    Thanks for the video! Amazing!

  • @bkrai

    @bkrai

    5 жыл бұрын

    Thanks for comments!

  • @bulletkip
    @bulletkip5 жыл бұрын

    absolutely excellent explanation. thank you very much.

  • @bkrai

    @bkrai

    5 жыл бұрын

    Thanks for comments!

  • @sengulozdemir418
    @sengulozdemir418Ай бұрын

    I appreciate your help, excellent video 👏🙏

  • @bkrai

    @bkrai

    Ай бұрын

    You are welcome!

  • @Chirag0729
    @Chirag07294 жыл бұрын

    Nicely explained. Thank you.

  • @bkrai

    @bkrai

    4 жыл бұрын

    Thanks for comments!

  • @fayarvin2003
    @fayarvin20032 жыл бұрын

    Really helpful!

  • @bkrai

    @bkrai

    2 жыл бұрын

    Glad it was helpful!

  • @dba99999
    @dba999996 жыл бұрын

    Great Video....

  • @zhongyanxu9047
    @zhongyanxu90473 жыл бұрын

    Amazing, very usefull, Thanks

  • @bkrai

    @bkrai

    3 жыл бұрын

    You are very welcome!

  • @veianthanjayaramu2995
    @veianthanjayaramu29952 жыл бұрын

    Thank you very much, sir.

  • @bkrai

    @bkrai

    2 жыл бұрын

    You are welcome!

  • @ahmedbilal1831
    @ahmedbilal18312 жыл бұрын

    Thanks alot man. you helped

  • @bkrai

    @bkrai

    2 жыл бұрын

    You are welcome!

  • @visheshgour
    @visheshgour4 жыл бұрын

    i think m the only one who doesn't able to learn any computer language except R and this all happen just bcs of u sir 🙂

  • @bkrai

    @bkrai

    4 жыл бұрын

    Thanks for comments!

  • @omkarthakur2251
    @omkarthakur22514 жыл бұрын

    Very good video sir it is very helpful

  • @bkrai

    @bkrai

    4 жыл бұрын

    Thanks for comments!

  • @raghavendras5331
    @raghavendras53315 жыл бұрын

    Thank you sir...very clear and crisp explanation. In one video I got all the information. From the explanation in the video, I got how to find cutoff for maximum accuracy, by doing this only one class has got more weight in my dataset. but how to find a threshold value of cutoff(which gives maximum of sensitivity and maximum of specificity).

  • @bkrai

    @bkrai

    5 жыл бұрын

    You can get that using the ROC curve. The color used on the curve changes from 0 to 1. You can identify a point on the curve that is closest to the ideal curve.

  • @raghavendras5331

    @raghavendras5331

    5 жыл бұрын

    Thank you sir

  • @merumomo
    @merumomo5 жыл бұрын

    Thank you for this great video! And thank you for prompt reply. I have questions. If we are doing machine learning, we need to create ROC using predictive model created by test set, correct? (in your "Logistic Regression with R" video, you created predictive model using test set. We need to validate the accuracy of the model). Also, if I want to use which.max func to plot the highest values on the eval plot, what code should I use?

  • @bkrai

    @bkrai

    3 жыл бұрын

    Seeing this today. But roc curves can be done for both train and test data.

  • @RoomeyRahman
    @RoomeyRahman6 жыл бұрын

    Dear Sir, Your tutorial helps us all to learn about data science. I learn many thing from your tutorial. Now I want to learn how we can make ROC and AUC for multi-class? May you make another video to teach us about multi-class model performance? Thank you

  • @bkrai

    @bkrai

    6 жыл бұрын

    Thanks for your comments, I'll add your suggestion to my list.

  • @santanumallik6992

    @santanumallik6992

    3 жыл бұрын

    @@bkrai Sir I have the same query my data set has three class in that case how will I get ROC & AUC curve

  • @kenzagharouit4041
    @kenzagharouit40415 жыл бұрын

    thx , very good video.

  • @bkrai

    @bkrai

    5 жыл бұрын

    Thanks for comments!

  • @mariaandreasantosruiz4491
    @mariaandreasantosruiz44917 жыл бұрын

    Thanks !!!!

  • @bkrai

    @bkrai

    3 жыл бұрын

    Welcome!

  • @sovon08
    @sovon085 жыл бұрын

    Thank you so much Sir..the video was really helpful in providing practical knowledge of dealing with predictive modelling problems in R..Can you please tell me how to apply weight of evidence/ fine classing in R - is there any ready made syntax?

  • @bkrai

    @bkrai

    5 жыл бұрын

    Thanks for your feedback! I've also added your suggestion to my list.

  • @avi20009
    @avi200096 жыл бұрын

    Sir How does ROC curve work when the dependent variable is not binary in nature, in essence more than 2 factors for which we have to model the data(Note: but not continious in nature).

  • @sriharshabsathreya
    @sriharshabsathreya6 жыл бұрын

    we an use Deducer package in R to directly run the ROC Curve library(Deducer) mymodel

  • @bkrai

    @bkrai

    6 жыл бұрын

    thanks!

  • @dorothymartin2477
    @dorothymartin247710 ай бұрын

    Hi Dr, when i do stacking of ensemble why do i get the roc curve in triangular shape?

  • @vishnukowndinya
    @vishnukowndinya4 жыл бұрын

    Hi Sir, i have calculated cut off for accuracy for my data (~0.475). i would like to know where exactly i should replace default 0.5 with this .475 ?

  • @rishikeshdash12
    @rishikeshdash122 жыл бұрын

    Sir, I have ran the model using neuralnet package , is it necessary to calculate probability for predicted value or we can directly go with value obtained for test set. One more question sir is it any way to plot roc curve for two models.

  • @sanjeevnair9893
    @sanjeevnair98934 жыл бұрын

    Hello Sir , i'm an avid viewer of your videos which truly add value to our ML understanding. Have a quick question that once we determine the Best Value of Cut Offs post Model performance evaluation , should we go back and re-run the Model performance with Best Cut Off values and change the cut off of 0.5 that we considered as thumb rule.

  • @bkrai

    @bkrai

    4 жыл бұрын

    Yes, that's correct.

  • @sanjibphukan8921
    @sanjibphukan89212 жыл бұрын

    Nicely explain. Sir, can you arrange to prepare a video on SVM of binary outcomes

  • @bkrai

    @bkrai

    2 жыл бұрын

    Try this. kzread.info/dash/bejne/oodpybp-fseZkZc.html

  • @irondia73
    @irondia734 жыл бұрын

    Hi Dr. Bharatendra Rai, would you be able to make a tutorial on building a logistic regression model using training and validation sets, with performance checking via ROC curve as you have done here? I know you posted one on linear regression, but I thought a logistic model would be very helpful too. Thank you!

  • @bkrai

    @bkrai

    4 жыл бұрын

    You can get logistic regression from this link: kzread.info/dash/bejne/c4qsmbmcYaa3Z7w.html ROC steps are already in the current lecture video.

  • @lewsmash
    @lewsmash5 жыл бұрын

    Hi, Firstly, great video this really helped me to understand the ROC curve and implement it with my data in R. I am analysing diagnostic data for a masters degree research project. I wanted to know how to identify the cutoff value from the value that we take from the accuracy versus cutoff curve or the final ROC curve. The scale goes from 0-1 but my independent variable data ranges from 100 to 10^7 . In short, how do I take the best cutoff value that this analysis outputs and relate/convert this to my independent variable and an exact cutoff value? Thanks very much.

  • @bkrai

    @bkrai

    5 жыл бұрын

    Cutoff value is for the dependent variable. If the dependent has two categories 'yes' and 'no', then default cutoff is probability = 0.5. ROC provides information on how prediction model performance will change if cutoff value changes from 0 to 1.

  • @devawratvidhate9093
    @devawratvidhate90935 жыл бұрын

    How to handle if my all data is categorical my predictor features are subject columns with 1 to 8 grades for each subject and response variable is subject where we have to predict response variable grades (1-8 ). Before applying model I converted all features and response variable into factors is this right step or should i only covert response variable into factors and keep predictors in numerical format

  • @bkrai

    @bkrai

    4 жыл бұрын

    I'm seeing this today, but for categorical variables you can try random forest: kzread.info/dash/bejne/ln6XzrCCfpC6gNI.html

  • @suryagaur7440
    @suryagaur74406 жыл бұрын

    Hi Sir, Thanks for wonderful video. Could also make AUC video where dependent variable is continuous.

  • @bkrai

    @bkrai

    6 жыл бұрын

    Thanks for the suggestion! I've added this to my list.

  • @kpakpomoevi1603
    @kpakpomoevi16034 жыл бұрын

    Im new to ur lecture and find it very interesting and useful.I have one question ?how do you get the cutoff .5 from the classification table @5:39mn of the video.Thanks

  • @kpakpomoevi1603

    @kpakpomoevi1603

    4 жыл бұрын

    I figure out and see it should be a default value.However I'm still having issue with the performance object eval.when I tried to print eval,it is giving me this : A performance instance 'Cutoff' vs. 'Accuracy' (alpha: 'none') with 392 data points please help me have what you had on your screen.Thanks

  • @bkrai

    @bkrai

    4 жыл бұрын

    You will see it better after plot.

  • @balasrm1
    @balasrm14 жыл бұрын

    Further to my earlier comment, also wanted to ask what software you used to create these videos on data analytics. Thanks

  • @bkrai

    @bkrai

    4 жыл бұрын

    I used iMovie.

  • @amitgajkal4821
    @amitgajkal48214 жыл бұрын

    i am getting following error when i use : pred

  • @bkrai

    @bkrai

    4 жыл бұрын

    Difficult to say anything without looking at code.

  • @juanmauricioarrietalopez2395

    @juanmauricioarrietalopez2395

    4 жыл бұрын

    Same error. Could you solve it?

  • @TH-fe1vs
    @TH-fe1vs7 жыл бұрын

    can you tell me the differences below: yourmodel

  • @davidserero9125

    @davidserero9125

    7 жыл бұрын

    I think yourmodel

  • @cameronyi683
    @cameronyi6837 жыл бұрын

    Hello. This looks like the cutoff would be the probability of a certain student getting admitted based on the multinomial model. If I am working with a dataset with one independent variable contributing to my multinomial model, and am wanting to obtain a cutoff value from that independent variable (ie what is the cutoff value of SAT score that will best tell me if someone is admitted to college), what would I be changing in the code? Thank you.

  • @lewsmash

    @lewsmash

    5 жыл бұрын

    I was also looking for this answer to this if you managed to find out?

  • @rafiqulislam1085
    @rafiqulislam1085 Жыл бұрын

    Very nice and Excellent explanation. Could you please make another video to draw multiclass (more than 2 class) Roc curve. (one vs rest roc )?

  • @bkrai

    @bkrai

    Жыл бұрын

    You can refer to these: kzread.info/dash/bejne/mKiesNeJm7O3cpc.html kzread.info/dash/bejne/aIeB1Mx-p6nPgbw.html

  • @tanyachichekian9900
    @tanyachichekian99004 жыл бұрын

    Hello Dr. Rai. Would you happen to know what code I can use to compare 2 ROCs and/or AUCs using R? Also, if there is a way to represent 2 ROCs in one graph. Thank you! ~ Tanya

  • @bkrai

    @bkrai

    3 жыл бұрын

    You can calculate AUC for different models and compare them. It should be higher the better.

  • @sanjibphukan8921

    @sanjibphukan8921

    2 жыл бұрын

    @@bkrai Sir, in that situation how can we get the p-value of the compared statistic.

  • @wanglaoshuwang3831
    @wanglaoshuwang38316 жыл бұрын

    I have a question about the logistic regression model part. Does the code deal with the whole data? I thought when doing the logistic regression model, you have to divide the data into training set and test set. In the code you've used, does it divide training set and test set automatically?

  • @bkrai

    @bkrai

    6 жыл бұрын

    I used full data as focus was more on ROC. But when developing a prediction model it is always good to partition data into training and testing data sets.

  • @wanglaoshuwang3831

    @wanglaoshuwang3831

    6 жыл бұрын

    Thank you so much! helped a lot! :)

  • @abhilashiv3599
    @abhilashiv35995 жыл бұрын

    Thank you so much sir, Just want to ask you whether type='response' is same as type='prob' when I am trying to give type='prob' , R is throwing an error like "Error in match.arg(type) : 'arg' should be one of “link”, “response”, “terms” ?

  • @bkrai

    @bkrai

    5 жыл бұрын

    'Response' usually could be classes such as 'yes' or 'no'. But 'prob' gives probability values. And that could lead to errors that you are getting.

  • @abhilashiv3599

    @abhilashiv3599

    5 жыл бұрын

    @@bkrai Thank you Sir

  • @SachinSingh-uh2xh
    @SachinSingh-uh2xh7 жыл бұрын

    Please do a video on sentiment analysis using R in detail... Deep dive analysis

  • @bkrai

    @bkrai

    7 жыл бұрын

    Thanks for the suggestion, I'll probably do it sometime this month.

  • @jennykeeping8918
    @jennykeeping89185 жыл бұрын

    Hi, I'm on R studio v. 1.1.423 now and nnet package isn't available and I can't seem to find an equivalent... any ideas what I can use to get the same results? Thanks.

  • @kamalpada1270

    @kamalpada1270

    5 жыл бұрын

    Please upgrade RStudio to atleast 1.1.463.. nnet works in this version.. Good luck.

  • @bkrai

    @bkrai

    4 жыл бұрын

    This is old comment. I guess you must have already updated.

  • @saurwt
    @saurwt6 жыл бұрын

    wooow just wooow!!!

  • @bkrai

    @bkrai

    3 жыл бұрын

    Thanks!

  • @rohithebbar722
    @rohithebbar7226 жыл бұрын

    Hello sir, can you make a video for ploting ROC curve for SVM. I am getting an error in my code. The error is i am getting is format of prediction is invalid. Thank you

  • @sriharshabsathreya
    @sriharshabsathreya6 жыл бұрын

    sir, how to identify the optimal cut off value so that TPR (sensitivity) will be high ?

  • @victorhenostroza1871
    @victorhenostroza18713 жыл бұрын

    Sir, based on this miss classification problem for admit =1, how can u change prob to other value in the model? maybe with under 0.45 =0 and over = 1

  • @bkrai

    @bkrai

    3 жыл бұрын

    ROC automatically tries probability values from 0 to 1 and then plots it on the curve.

  • @francodjo
    @francodjo6 жыл бұрын

    I need some help please trying to submit my project but cannot get ROC work

  • @fatimabadi3335
    @fatimabadi33354 жыл бұрын

    Thanks for the useful information. I would like to ask you if I can use ROC to measure the effectiveness of the prediction model? And can I use ROC in R software?

  • @bkrai

    @bkrai

    4 жыл бұрын

    For model effectiveness you can use AUC. Also yes you can do ROC in R, this video gives you all the steps.

  • @fatimabadi3335

    @fatimabadi3335

    4 жыл бұрын

    Dr. Bharatendra Rai thanks

  • @avinashsingh357
    @avinashsingh3577 жыл бұрын

    Explained very neatly sir, appreciate if you can pls add dataset and code for learning please....

  • @bkrai

    @bkrai

    7 жыл бұрын

    email id?

  • @avinashsingh357

    @avinashsingh357

    7 жыл бұрын

    Thanks for your quick response sir, my emailid is avinashsinghemailid@gmail.com

  • @bkrai

    @bkrai

    7 жыл бұрын

    all set.

  • @oumaimanassiri5555
    @oumaimanassiri55556 жыл бұрын

    Hi Professor, i love your videos ,it's very interesting.I'm a PhD student , sometimes i find difficult to have the link between my own variables ( concengrations of elements) and the variables that you work with, that's why ; I wish you have documents well explained concerning the data processing analysis to sends it to me I will be very grateful . Also i want that you sent me the data file.

  • @bkrai

    @bkrai

    6 жыл бұрын

    email id?

  • @abdulazeez9863
    @abdulazeez98635 жыл бұрын

    I have applied the same functions in evaluation of my GAM model where I am not able to produce the confusion matrix. The results shows 2*132 table matrix instead of 2*2 matrix moreover I have 203 'Y" variable in validation data. Why its coming so. Plz help me. Thanking you.

  • @nithinmamidala
    @nithinmamidala5 жыл бұрын

    very helpful video sir. thank you so much. I have a doubt how do you fix the threshold value as 0.5.

  • @bkrai

    @bkrai

    5 жыл бұрын

    Default threshold is already 0.5, there is no need to do anything for this.

  • @nithinmamidala

    @nithinmamidala

    5 жыл бұрын

    Ok.. Thankyou sir.

  • @ravikirandhulipala7501
    @ravikirandhulipala75015 жыл бұрын

    Hi Sir, When I try using "prediction" function on a multinomial target variable and a matrix of predicted probabilities, I am getting the error below: Error in prediction(preTrainProb015, train015$Delq.Status) : Number of cross-validation runs must be equal for predictions and labels. In the above error: preTrainProb015

  • @bkrai

    @bkrai

    5 жыл бұрын

    " Number of cross-validation runs must be equal for predictions and labels." Looks like you have mis-match between predictions and labels. Probably you have to review earlier lines of code.

  • @lianjek5788
    @lianjek57883 жыл бұрын

    hi sir, I have some confusion, please help me to resolve it. Your IV (admit) has two levels...0 and 1 and you performed multinomial logit? Is it obvious to plot a multiclass ROC rather than a typical ROC curve, when my IV has three levels ( i.e. 1,2, and 3). Thanks.

  • @bkrai

    @bkrai

    3 жыл бұрын

    Multinomial logit works for 2 or more levels. However, ROC used here is only for situations where IV has 2 levels.

  • @lianjek5788

    @lianjek5788

    3 жыл бұрын

    @@bkrai Would you please provide a lecture about multiclass ROC? Thanks.

  • @bkrai

    @bkrai

    3 жыл бұрын

    Thanks, I've added it to my list.

  • @damodharand1519
    @damodharand15194 жыл бұрын

    I need to know how the medical data set are going to use in R studio programming and (example MIMIC, DCOM, etc) which library i have to use... pls if you know anyone inform...

  • @bkrai

    @bkrai

    4 жыл бұрын

    You can try these: kzread.info/head/PL34t5iLfZddsQ0NzMFszGduj3jE8UFm4O

  • @juarezantonio656
    @juarezantonio656 Жыл бұрын

    Unfortunately unable to proceed. An error message appears: pred

  • @puneetksidhu
    @puneetksidhu5 жыл бұрын

    Hello Sir, are precision and recall same as sensitivity and 1-specificity respectively?

  • @puneetksidhu

    @puneetksidhu

    5 жыл бұрын

    if we would have to plot a PR curve for the same data that you used to plot ROC curve, how would we do that? Can you please send me the code at puneetkaursidhu@gmail.com

  • @uhsay1986
    @uhsay19865 жыл бұрын

    Hi Sir , why did you use multinom function here ? isnt multinom used only if target var have more than 2 categories ? while in this video we have only 2 categories , yes or no ?

  • @bkrai

    @bkrai

    5 жыл бұрын

    Multi works for 2 or more, so using it here should be ok.

  • @muldon2
    @muldon25 жыл бұрын

    for those who are looking for the data: stats.idre.ucla.edu/r/dae/logit-regression/

  • @bkrai

    @bkrai

    5 жыл бұрын

    Thanks for sharing!

  • @abhibhavsharma8706
    @abhibhavsharma87064 жыл бұрын

    In place of "tpr", will a numeric entry work?

  • @bkrai

    @bkrai

    4 жыл бұрын

    I've not tried, but should work.

  • @kessiezhang9357
    @kessiezhang93575 жыл бұрын

    Hi Bharatendra, why don't you use glm()? I looked it up and it seems like multinom is used when the dependent has more than 2 levels. In your example, the dependent is admin(no, yes). That's why I'm confused why you chose multinom () instead of glm(). Thank you.

  • @bkrai

    @bkrai

    5 жыл бұрын

    multinom works for 2 or more. So when dependent variable has 2 levels, it should work fine.

  • @ranjitshekdar1720
    @ranjitshekdar17207 жыл бұрын

    Would you be able to send me the dataset used for this please? awesome job done.

  • @ranjitshekdar1720

    @ranjitshekdar1720

    7 жыл бұрын

    rshekdar@gmail.com my email id. sorry accidentally clicked send before could complete.

  • @bkrai

    @bkrai

    7 жыл бұрын

    +Ranjit Shekdar all set.

  • @ranjitshekdar1720

    @ranjitshekdar1720

    7 жыл бұрын

    you sir are very fast, much appreciated. Thanks again. I was not expecting it to be sent out so fast.

  • @abhitest1
    @abhitest15 жыл бұрын

    Sir, can you please also attach dataset files/link along with your videos. This would greatly help us in learning by practicing with same data set. Thanks for great videos sir.

  • @bkrai

    @bkrai

    5 жыл бұрын

    I've added a link in the description area below the video.

  • @abhitest1

    @abhitest1

    5 жыл бұрын

    @@bkrai thanks.

  • @hamsinisankaran2435
    @hamsinisankaran24356 жыл бұрын

    Thank you for a great tutorial sir. Could you please share the dataset and the code ?

  • @bkrai

    @bkrai

    6 жыл бұрын

    email id?

  • @hamsinisankaran2435

    @hamsinisankaran2435

    6 жыл бұрын

    hamsini0992@gmail.com. Thank you

  • @bkrai

    @bkrai

    6 жыл бұрын

    all set.

  • @mohsinfayaz8103
    @mohsinfayaz81033 жыл бұрын

    How to generate ROC AUC curve for multi class responsible variable? Thank You

  • @bkrai

    @bkrai

    3 жыл бұрын

    You can use this method with two class at a time.

  • @prahladbhat9516
    @prahladbhat95163 жыл бұрын

    How do I do this AUC I have NA Values in my dataframe?

  • @bkrai

    @bkrai

    3 жыл бұрын

    You need to first address missing values. See this link: kzread.info/dash/bejne/c6Jr0LKFepPMo8o.html

  • @kalyanasundaramsp8267
    @kalyanasundaramsp82676 жыл бұрын

    Sir, a)for multi-class, how you will will come with false positive, false negative b)how to compute ROC for multiclass

  • @bkrai

    @bkrai

    6 жыл бұрын

    I'm adding this to my list. Thanks!

  • @SaranathenArunE

    @SaranathenArunE

    5 жыл бұрын

    thanks so much sir

  • @simranpaul1407
    @simranpaul14076 жыл бұрын

    sir where do i get this dataset??

  • @bkrai

    @bkrai

    6 жыл бұрын

    email id?

  • @rahulranjan8090
    @rahulranjan80906 жыл бұрын

    Hello Sir, Why are we using [[1]] in which.max function?

  • @bkrai

    @bkrai

    6 жыл бұрын

    That's where the value we are looking for is stored.

  • @olamidegab2390
    @olamidegab23903 жыл бұрын

    Hello, can this be applied on CNN?

  • @bkrai

    @bkrai

    3 жыл бұрын

    If there are two classes, then yes.

  • @roopashastri9908
    @roopashastri99087 жыл бұрын

    Hi Sir, One question here. Can ROCR curve be drawn in case of multiple classification. Ex:We have to classify the given data in 3 different classes? Thanks, Roopa

  • @bkrai

    @bkrai

    7 жыл бұрын

    It is meant for only two categories. If you have three classes such as 1, 2, and 3. And if your interest lies more in correctly classifying say class "3", then you may still have two classes with 3 and others.

  • @roopashastri9908

    @roopashastri9908

    7 жыл бұрын

    ok..got it.Thank you sir!

  • @shubhammishra8550
    @shubhammishra85505 жыл бұрын

    why u wrote 'y.values' in slot function of AUC?

  • @bkrai

    @bkrai

    5 жыл бұрын

    When you run 'eval' that contains that contains accuracy values for various cut offs, you can see different type of information are stored in various slots. And y.values contain data on accuracy.

  • @sheikhseerat7105
    @sheikhseerat71053 жыл бұрын

    Very nice explanation Could u plzz send me dataset and code

  • @bkrai

    @bkrai

    3 жыл бұрын

    For data, see link below video. For code, see the pinned comment.

  • @raj2385
    @raj23858 ай бұрын

    if am using 2 variables only GPA and Admit then what will be the Logistic Regression Model formula

  • @bkrai

    @bkrai

    8 ай бұрын

    You can refer to this: kzread.info/dash/bejne/c4qsmbmcYaa3Z7w.html

  • @tapangautam8746
    @tapangautam87466 жыл бұрын

    Hello sir, Video was excellent but I have small question. Cut off value changed to 0.45 so do we need to again run model. If not then why and if yes then what changed need to be made in code so that pure classification can be made for improving accuracy level of model.

  • @bkrai

    @bkrai

    6 жыл бұрын

    You don't need to run model again. The model gives predictions in terms of probabilities. When we use cutoff of 0.45, probabilities that are less than 0.45 are classified into first group and those above 0.45 are classified into 2nd group. So for any cutoff value, probabilities from prediction model are not going to change, they are only used for classification.

  • @tapangautam8746

    @tapangautam8746

    6 жыл бұрын

    Thank you sir for your reply and for guiding me I am want to know one more thing, as according to your reply I can assume probability less then 0.45 as yes and above 0.45 as no in terms of dependent variable. But where or on which sort of output I will come to know that due to variation in independent variable majority of time dependent variable occur (yes or no). Thanks

  • @bkrai

    @bkrai

    6 жыл бұрын

    Independent variable will take only one value for each case. If a new student has GRE = 380, GPA = 3.61 and comes from a school ranked 3, then inputting these values in the prediction model will give probability = 0.18. Since p=0.18 is less than cutoff = 0.45, this student will be rejected and will not get admission.

  • @tapangautam8746

    @tapangautam8746

    6 жыл бұрын

    Good morning, now I understand answer. Thanks for helping me in compression of logistic regression

  • @tapangautam8746

    @tapangautam8746

    6 жыл бұрын

    Hello Sir I need little help from your side. In code where we create subset out of sample why == TRUE or FALSE is used. What is difference between = and == symbol in Logistic regression. Thank you sir

  • @tamaraabzhandadze2712
    @tamaraabzhandadze27122 жыл бұрын

    How could we cross validate these results?

  • @bkrai

    @bkrai

    2 жыл бұрын

    You can refer to this for more detailed coverage: kzread.info/dash/bejne/mKiesNeJm7O3cpc.html

  • @fabioambrosini5265
    @fabioambrosini52655 жыл бұрын

    what does represent the color from green to red of the ROC?

  • @bkrai

    @bkrai

    4 жыл бұрын

    It represents cutoff values between 0 and 1.

  • @fabioambrosini5265

    @fabioambrosini5265

    4 жыл бұрын

    Dr. Bharatendra Rai thanks

  • @umairrasool9580
    @umairrasool95803 жыл бұрын

    Hello Sir, Thanks for your every lecture for students like me. Respected Sir, i am working on Groundwater potential mapping, i have compete my analysis using ArcGIS, now i have to validate my results with ROC curve, could you please guide me how could it possible using R. I will be very thankful to you.

  • @bkrai

    @bkrai

    3 жыл бұрын

    You can follow the steps in this video. If you get struck anywhere, let me know.

  • @umairrasool9580

    @umairrasool9580

    3 жыл бұрын

    @@bkrai Sir i have get problem here, please check, how to make model with my data? setwd("C:/Users/Umair/OneDrive/Manuscript Quetta GWP/ANN") .libPaths("C:/Users/Umair/OneDrive/Manuscript Quetta GWP/library ANN") install.packages("tidyverse") library(tidyverse) Wells

  • @bkrai

    @bkrai

    3 жыл бұрын

    Which part has a problem?

  • @umairrasool9580

    @umairrasool9580

    3 жыл бұрын

    @@bkrai Sir problem to make model for ROC and need to compute the true + and true -.

  • @subaganesh552
    @subaganesh5523 жыл бұрын

    Hello sir.. is possible to calculate auc metric for multiple class prediction

  • @bkrai

    @bkrai

    3 жыл бұрын

    I'll look into this.

  • @subaganesh552

    @subaganesh552

    3 жыл бұрын

    @@bkrai thank you sir...

  • @bkrai

    @bkrai

    3 жыл бұрын

    welcome!

  • @abdulhalim9472
    @abdulhalim9472 Жыл бұрын

    I can not find ant 'y.value' in eval

  • @francodjo
    @francodjo6 жыл бұрын

    Great video, trying to plot ROC for random fors but it giving me the following error Error in prediction(p2, train$Dispute) : Number of cross-validation runs must be equal for predictions and labels

  • @bkrai

    @bkrai

    6 жыл бұрын

    what are your previous lines before this line where you are getting error?

  • @francodjo

    @francodjo

    6 жыл бұрын

    no error. thank you very much for quick response can you forward me the co

  • @francodjo

    @francodjo

    6 жыл бұрын

    library(randomForest) TD_model

  • @bkrai

    @bkrai

    6 жыл бұрын

    i've sent my code file.

  • @bkrai

    @bkrai

    6 жыл бұрын

    note that the response variable here has two levels. If your data has more, then the codes shown in the video may not work as it is.

  • @mashalnabh2747
    @mashalnabh27475 жыл бұрын

    Hello, This is great video but I am slightly confused with the probability explanation. YOu mentioned that if the prob prediction score is less than .5 then chance are less than average but doesn't it depend on %age of events in the data on which model is based? If in the sample data, the event rate is 1 out of 4 then probability is .25, so any scores above .25 in the final output mean model is saying that this has higher chances. Not necessarily it has to be above .5.

  • @bkrai

    @bkrai

    5 жыл бұрын

    In this data there are only two outcomes. Either a student is admitted or not-admitted. If you only calculate % as students admitted and use that as a probability, it will not be a very useful prediction. Because it will remain same for every students irrespective of their gpa, sat score or college they are coming from. The prediction in the form of probability between 0 and 1 here is based on all input variables.

  • @mashalnabh2747

    @mashalnabh2747

    5 жыл бұрын

    @@bkrai Hello, Let me give an example: Lets say in your data set , there were 100 observations and 10 "events" of passing . So the probability of an event in your data set is 10/100= 0.1 . Now I build the prediction model based on different predictors like Gap, SAT, gender etc, and I get the final predicted probability scores. Lets say for some student, we get a score of .3,. All I want to say is that this student has higher chances than average. Not necessary the probability score has to be above .5. This depends upon the original percentage events in your data on which the model is built - which in this case is 0.1

  • @bkrai

    @bkrai

    5 жыл бұрын

    For original %, let's consider your own data. Let's say 10 out 100 applicants get accepted giving a rate of 0.1. Now forget about any type of model and simply classify all 100 students as getting accepted. Here without any model, you will be correct 10% of the time, but incorrect 90% of the time. Do not mix-up this overall rate with individual probability. When you develop a prediction model, it should give overall accuracy better than 90% to be of any value.

  • @sachin01663

    @sachin01663

    5 жыл бұрын

    @@bkrai Thanks. Am I right to say that predicted probability score less than .5 (after building the final model) does not necessarily mean that, that event is less likely to happen.

  • @bkrai

    @bkrai

    5 жыл бұрын

    That's correct.

  • @sside99
    @sside996 жыл бұрын

    cutoff means threshold?

  • @bkrai

    @bkrai

    6 жыл бұрын

    That's correct.