Support Vector Machine (SVM) with R - Classification and Prediction Example

Поделиться
HTML-код
  • Опубликовано: 11 мар 2017
  • Includes an example with,
    - brief definition of what is svm?
    - svm classification model
    - svm classification plot
    - interpretation
    - tuning or hyperparameter optimization
    - best model selection
    - confusion matrix
    - misclassification rate
    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
    svm is an important machine learning tool related to analyzing big data or working in data science field.
    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.

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

  • @AnalyticsMaster
    @AnalyticsMaster 7 лет назад +7

    Thumbs up !!
    most of your tutorials are pretty useful.
    you have a good knack of explaining complicated techniques in a simplified way.

    • @bkrai
      @bkrai  7 лет назад

      Thanks for the feedback!

  • @delt19
    @delt19 6 лет назад +2

    Your tutorials are priceless. Thank you for sharing your knowledge. This was easy to understand and to the point.

    • @bkrai
      @bkrai  6 лет назад

      Thanks for comments!

  • @kabeeradebayo9014
    @kabeeradebayo9014 7 лет назад +2

    Thank you for your made simple and easy to follow video tutorials. You are awesome!

    • @bkrai
      @bkrai  7 лет назад

      Thanks for your feedback!

  • @joujoumilor2898
    @joujoumilor2898 5 лет назад +2

    you're the best teacher ever

    • @bkrai
      @bkrai  5 лет назад

      Thanks for your comments!

  • @tadessemelakuabegaz9615
    @tadessemelakuabegaz9615 2 года назад +1

    Thank you so much. A great explanation of the SVM model.

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

      You are welcome!

  • @thetardheinrich
    @thetardheinrich 6 лет назад +2

    Very clear and helpful. Thank you sir!

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

      Welcome!

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

    #Learning From "Support Vector Machine (SVM) with R-Classification and Prediction Example
    #准备工作,加载数据,并看一下数据的分布
    data("iris")
    str(iris)
    library(ggplot2)
    qplot(Petal.Length, Petal.Width, data=iris, color=Species)
    #第一步:运行SVM,选择合适的Kernel方法
    library(e1071)
    mymodel=svm(Species~., data=iris, kernel = "polynomial")
    #-------将mymodel的Kernel方法改为radial,linear,也可以改为polynomial
    summary(mymodel)
    #第二步:Tuning,即超平面优化,选择最佳模型
    set.seed(123)
    tmodel=tune(svm, Species~., data = iris, ranges = list(epsilon =
    seq(0,1,0.1), cost = 2^(2:9)))
    #-------seq生成一个序列,0开始,1结束,中间相隔0.1,一共11位数;
    #-------cost取值为2到9,一共8位数,11x8=88个参数模型,如果数据很大,则需要很久
    plot(tmodel)
    summary(tmodel)
    #第三步:选择最佳的模型,并作图
    mymodel=tmodel$best.model
    summary(mymodel)
    plot(mymodel, data = iris, Petal.Width~Petal.Length,
    slice = list(Sepal.Width = 3, Sepal.Length = 4))
    ##Petal.Width~Petal.Length,定义谁是X,谁是Y
    #第四步:计算预测能力
    ##Confusion Matrix and MisClassification Error
    pred=predict(mymodel, iris)
    tab = table(Predicted = pred, Actual = iris$Species)
    tab #tab用来查看预测的结果
    1-sum(diag(tab))/sum(tab) #计算预测失败的概率

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

      Not sure about your question.

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

      @@bkrai Thanks. It's the R code for this video.

  • @ravindarmadishetty736
    @ravindarmadishetty736 7 лет назад +2

    Excellent Session sir on SVM...Very Useful

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

      Thanks!

  • @kabeeradebayo9014
    @kabeeradebayo9014 7 лет назад +2

    Thank you again for these complete episodes. You have been of a great help to me "Rai". Please, I'd appreciate a complete episode on the ensembles, essentially, heterogeneous ensemble using DT, SVM etc. inclusive as the base classifiers.
    Comprehensive videos on ensembles are not common, in fact, I haven't come across any. It will go a long way If you could put something together on this. Thank you for your help!

    • @bkrai
      @bkrai  7 лет назад

      Thanks for the suggestion, I'll do it in near future!

  • @parasrai145
    @parasrai145 6 лет назад +2

    Very well explained and very useful!

    • @bkrai
      @bkrai  6 лет назад

      Thanks!

  • @RamoSFTT
    @RamoSFTT 6 лет назад +1

    I am an avid subscriber of yours. Your videos are simply outstanding and very helpful for self study. Thank you very much for your videos and all the hard work.

    • @bkrai
      @bkrai  6 лет назад

      Thanks for feedback and comments!

  • @zhuziyan9454
    @zhuziyan9454 6 лет назад +2

    god blesses you sir. You are the best and much appreciate!!!

    • @bkrai
      @bkrai  6 лет назад

      Thanks for comments!

  • @kumarsabat1520
    @kumarsabat1520 6 лет назад +2

    One Word --- Awesome , Thanks Sir..

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

      Welcome!

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

    Thank you Dr. Rai. This video was really helpful and entertaining.

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

      You are welcome!

  • @bugsysiegals
    @bugsysiegals 6 лет назад +1

    Excellent video!! Thanks for sharing.

    • @bkrai
      @bkrai  6 лет назад

      Thanks for comments!

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

    Very nice video. Easy to understand. Appreciated your effort.

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

      Thanks for comments!

  • @jitendratrivedi7889
    @jitendratrivedi7889 6 лет назад +2

    very informative and well explained.

    • @bkrai
      @bkrai  6 лет назад

      Thanks for your comments!

  • @vishnunath1524
    @vishnunath1524 7 лет назад +2

    Thank you Mr. Rai for this excellent demonstration and explanation of SVM.
    Regards.

    • @bkrai
      @bkrai  7 лет назад +1

      thanks for feedback!

  • @sojibulislam1004
    @sojibulislam1004 2 года назад +1

    Dear Sir, Thank u very much for the video and code. I can say I learned ML and r coding using your tutorial much more than udemy, lynda, and other works. Good Job. Your channel is the best indeed!

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

      You are most welcome!

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

    Very good explanation! Instantly subscribed to your channel.

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

      Thanks for comments!

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

    Thank you very much from the bottom of my heart.

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

      You are very welcome!

  • @RohitRajputshiv
    @RohitRajputshiv 7 лет назад +3

    Thank you sir....

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

      Welcome!

  • @flamboyantperson5936
    @flamboyantperson5936 6 лет назад +5

    Sir will you please explain me what does Cost, gamma and radial means and what they do? Also explain me Radial and Sigmoid. I'm sorry too many questions I have asked but since you always help me to understand the concept clearly it's my request. Thank you Sir.

  • @anjana8080
    @anjana8080 7 лет назад +2

    excellent really worth

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

      Thanks!

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

    You are really great Sir!!!!

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

      Thanks for comments!

  • @shalinikumari-gk3ls
    @shalinikumari-gk3ls Год назад +1

    Sir your teaching is excellent please post some videos on how handle semi supervised machine learning algorithm in R especially in case of SVM

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

      Thanks for the suggestion!

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

    Thank you so much Sir!

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

      Most welcome!

  • @shuchismitagiri9257
    @shuchismitagiri9257 2 года назад +1

    Thank you sir for this video

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

      Most welcome!

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

    Thanks for your video!! How to calculate AIC and BIC in SVM?

  • @BalasubrahmanyamIra
    @BalasubrahmanyamIra 5 лет назад

    I see that many videos say let us predict and use the predict command. What are you trying to predict? What is the output is being expected?

  • @mohamedgomaa2645
    @mohamedgomaa2645 6 лет назад

    Many thanks again for your amazing video.
    Can you let me know how we evaluate the variables?
    Such as we have 10 variables but only 5 of them are significant (for ex; in logistic regression, we evaluate them by P-value and OR (95%CI)).
    Some said that we use weight to evaluate them, every variable has its weight, the higher the weight, the more signficant.
    And can you give me the code for that?

  • @tejasavkhattar6617
    @tejasavkhattar6617 5 лет назад

    Thankyou Sir, This tutorial was quite useful but I am trying to create a user-defined function for SVM analysis in which I can define the data set kernel, and other parameter for the data set in function calling. How can I do that ?

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

    Incredible explain sir....plz made a video list of parametric and non parametric test..as early as possible

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

      Thanks for the suggestion!

  • @Didanihaaaa
    @Didanihaaaa 6 лет назад +6

    Hello Dr. Rai, Thanks for your great tutorials. I shoud say I learnt ML and r coding using your tutorial much more than udemy, lynda, and other works. Good Job. Your channel is the best indeed! I suggested to all my frineds!
    I was wondering that would you teach us some machine learning in python?

    • @bkrai
      @bkrai  6 лет назад +1

      Thanks for your comments! I'll plan to do python in few months.

  • @kalyanasundaramsp8267
    @kalyanasundaramsp8267 6 лет назад +2

    brilliant, brilliant, brilliant sir.....request= can you do one please for regression

    • @bkrai
      @bkrai  6 лет назад

      Thanks, I've added it to my list.

    • @kalyanasundaramsp8267
      @kalyanasundaramsp8267 6 лет назад +1

      thankyou sir, can you please share the link

    • @bkrai
      @bkrai  6 лет назад

      Here is the link:
      drive.google.com/open?id=0B5W8CO0Gb2GGc1ZZQWhmMmpuWWc

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

    good explanation

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

      Thanks for comments!

  • @zhangting1446
    @zhangting1446 6 лет назад +2

    Thank you so much for your wonderful videos!
    There is one question about this video, that is , when using the function "tune", it always says that "Error in if (tunecontrol$cross > n) stop(sQuote("cross"), " must not exceed sampling size!") :
    argument is of length zero"
    Have searched for solutions and tried to convert the data used to a list but still did not work.
    Would you please suggest how to fix it?
    Thank you!

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

      I saw this today, probably by now you must have addressed this.

  • @jesusb9562
    @jesusb9562 11 месяцев назад

    Why when you used the slice function you set Sepal.Width = 3 and Sepal.Length = 4 ? Is this just for convenience since they are the last two variables that need to be accounted for? Are these the boundaries that are created when you created the graph?

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

    Hi, Rai thanks for this clear lecture. But I have a question: I follow the exactly same steps as yours, but when use tune function, I get a different result from you. I get the best parameter: cost 4 (instead of 8 as yours), the best performance 0.04 (instead of yours 0.033). But all the steps i just exactly the same with you. Do you have any idea why it happened?

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

    Thanks a lot Dr. Rai for uploading this tutorial. I would like to apply this SVM method to calculate a susceptibility index able to be plotted in ArcGIS, so I need to know the predicted values of the dependence variable:
    1. How can be calculated?
    2. Can I use for that the same coding as in the case of neural network?
    Thank you very much

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

      Hii, I am also facing a similar issue. I have developed the model using the training dataset and tested it. But I am not sure how to import the developed model in ArcGIS to apply it to the actual raster layers!!
      Can you help me out?

  • @Peterdemeter123
    @Peterdemeter123 2 месяца назад +1

    very good job

    • @bkrai
      @bkrai  2 месяца назад

      Thanks for comments!

  • @audreytetteh6956
    @audreytetteh6956 5 лет назад

    is there anything i can do to get the size of every specie? i get the number of support vectors alright but it doesn't show the distribution... and also, i have 38 variables... how do i plot the graph for all of them?

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

    Thank you very much, please can you give me how to downsampling And oversampling the positive data samples to avoid data imbalance

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

      Here is the link:
      ruclips.net/video/Ho2Klvzjegg/видео.html

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

    Sir, how to identify the important variables in SVM when we have a set of variables?

  • @maheshmahi1593
    @maheshmahi1593 6 лет назад

    Sir , can u explain the inutution for three classes what is going on, as u explained for the two classes..on e hyperplane is drawn between two classes ..if the third class is there how does it separate

  • @Didanihaaaa
    @Didanihaaaa 6 лет назад +2

    Hello. Thanks for your videos. I was wondering that could you teach us about genetic programming in R if there is any? Thanks

    • @bkrai
      @bkrai  6 лет назад +1

      Thanks for the suggestion, I;ve added this to my list.

  • @kalyanasundaramsp8267
    @kalyanasundaramsp8267 6 лет назад +1

    super sir, here there is clear separation but "cleveland heart" from UCI is complex and have lot of overlapping...

    • @bkrai
      @bkrai  6 лет назад

      That's right. And for data that have lot of overlapping, it is always a good idea to try more methods.

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

    Sir for large sample value what could be the value of epsilon and cost..

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

    Okay , if i got the model ... how can i do to get an equation to for example use it in an application ? i mean to reproduce the classification results without R ? Thank you

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

    Very nice video to watch during my exam preparations! The music would be nicer if it was maybe 50% of the volume at any point where you are talking. Otherwise well explained and great to watch :)

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

      Thanks for the tip!

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

      @@bkrai epsilon doesn't seem to have any effect of the results when I use tune like you do. But I found that another example used "gamma" instead of "epsilon" for another model and that had an effect on SVM for me (surprisingly). Do you know why it's like that?

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

    Sir your videos are excellent and very easy to understand...!! Can you please post a video on regression models using SVM and ANN? That would be a great help in understanding the differences in results and validation parameters observed by using same algorithms. Thank you.

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

      For ANN, you can use:
      ruclips.net/video/SrQw_fWo4lw/видео.html

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

      @@bkrai Yes sir... I had already went through that video but I wasn't able to perform that with my data. That's why I'm requesting you for the same.

  • @anjaliacharya9506
    @anjaliacharya9506 5 лет назад

    I cannot understand why do we use slice ?Could you please explain more about it.

  • @dr.bheemsainik4316
    @dr.bheemsainik4316 3 года назад

    Sir, may i know why sepal length and sepal width assigned with constant values. that means we can't plot model with more than 2 variables. if I have assign constant values, how to decide the constant values like you have assigned 3 and 4. suppose I have used boruta algorithm for variables selection before running SVM model. i got 5 variables out of 10 variables as important. then how to plot SVM model. please help me by replying to my comment

  • @dennismontoro7312
    @dennismontoro7312 5 лет назад +1

    Does SVM capture the nonlinear interaction effects across variables when using RBF?

    • @bkrai
      @bkrai  5 лет назад +1

      That's correct.

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

    I did this
    tuned_model

  • @swamchem
    @swamchem 6 лет назад +3

    Thanks for the wonderful session on SVM. I have a question regarding how did you choose value for epsilon , cost for the tuned model. If it is a trial and error method, I would like to know how did you end up getting that.

    • @bkrai
      @bkrai  6 лет назад

      The best values are chosen by the model itself from the range that we provide.

    • @swamchem
      @swamchem 6 лет назад

      yes I agree that sir. But how did you come up with this range. it looks like the optimal value is entirely depends on the range which we provide. is that right?.

    • @swamchem
      @swamchem 6 лет назад

      Yes I agree sir. But how did you come up with that range. It looks like that the optimum value for cost & epsilon is entirely depends on range we provide. Is that right sir?.

    • @bkrai
      @bkrai  6 лет назад

      For epsilon the range has to be between 0 and 1. So you can try 0.1 increments. If the plot suggests further fine-tuning, you can even try 0.05 or 0.01 increments. For cost default value is 1. And as mentioned in the video, you need to try very wide range and that's why we have used 2^2 etc. For most situation this approach will help you to get best values for these parameters. The idea is to have very wide range for both so that you don't miss the best values.

    • @swamchem
      @swamchem 6 лет назад +1

      oh fine sir.

  • @kalyanasundaramsp8267
    @kalyanasundaramsp8267 6 лет назад +1

    Sir, for discrete independent variables, can we use them as factors model?

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

      Yes, should work fine.

  • @93divi
    @93divi 6 лет назад

    Sir,
    I am unable to understand this line:
    slice = list(Sepal.Width = 3, Sepal.Length = 4))
    What is the use and why 3 and 4?

  • @helloinfo7657
    @helloinfo7657 5 лет назад

    hi sir we need svm treat binary database on java would help us with this?

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

    Hello sir, in the 14 line from script (4.56 mins in vedio) we have slice, how to select the values in it and if many variables are the in the data, should we take SVM seperately between two variables each time?

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

      This is what slice represents - "a list of named values for the dimensions held constant (only needed if more than two variables are used). The defaults for unspecified dimensions are 0 (for numeric variables) and the first level (for factors). Factor levels can either be specified as factors or character vectors of length 1."
      In the video we used values that are more reasonable than default zero.

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

    on tuning im getting this error..please help sir...Error in do.call(method, c(list(train.x, data = data, subset = train.ind[[sample]]), :
    'what' must be a function or character string
    >

  • @machinelearningzone.6230
    @machinelearningzone.6230 4 года назад +2

    Hi sir,
    Can you please explain the significance of the parameters epsilon!
    Regards

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

      It affects the number of support vectors.

  • @priyadipmanna4393
    @priyadipmanna4393 5 лет назад +1

    graet video sir.. sir can u make a video on Taylors diagram.

    • @bkrai
      @bkrai  5 лет назад

      Thanks for comments and suggestion!

  • @Sergei_B
    @Sergei_B 6 лет назад +1

    Can you show us in other video how to do the support vector regreesion with a dataset with many variables? It will be great

    • @bkrai
      @bkrai  6 лет назад +1

      thanks for the suggestion, I've added it to my list.

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

    Very good content Sirji!
    Sir how to used the best model for testing data set ?

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

      Instead of iris data with the model, you can use test data.

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

      @@bkrai Thanks Sirji

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

      welcome!

  • @linkmetoo
    @linkmetoo 6 лет назад

    Hi Bharatendra, I am trying to run SVM model on dataset with 15 features and the label is binary, it looks something like this
    y_test$SurveyYes

    • @bkrai
      @bkrai  6 лет назад

      I would suggest try and use the same format as shown in the video.

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

    Dr, do you have any numeric svm (regression) tutorial?

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

      Not yet.

  • @kathytovar7112
    @kathytovar7112 7 лет назад +1

    Hi! Excellent tutorial! all very clear.. I have a data set with four columns only, these are location, duration, date and time. I implemented the svm model for prediction, but all predicted values are incorrect. How can I approach date and time? I did normalize the data but still prediction rate is bad.

    • @bkrai
      @bkrai  7 лет назад

      If one of the variables is date/time related, I would say use time series. Facebook recently open sourced its time series forecasting package. Here is the link:
      ruclips.net/user/edit?o=U&video_id=7xDAYa6Ouo8

    • @kathytovar7112
      @kathytovar7112 7 лет назад

      Hi! thank you, but the link is pointing to an empty page of youtube.

    • @bkrai
      @bkrai  7 лет назад

      Here is the correct link:
      ruclips.net/video/7xDAYa6Ouo8/видео.html

  • @ArpitSingh-dz7gt
    @ArpitSingh-dz7gt 4 года назад +1

    Sir what does slice =list (sepal. Width=3,sepal.length=4 ) indicates?

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

      This is what slice represents - "a list of named values for the dimensions held constant (only needed if more than two variables are used). The defaults for unspecified dimensions are 0 (for numeric variables) and the first level (for factors). Factor levels can either be specified as factors or character vectors of length 1."
      In the video we used values that are more reasonable than default zero.

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

    1. While ploting the model at 4:06, why did u choose "Petal.Width~Petal.Lenght"? Is it because these variables have low correlation?
    2. Also what is the reason to select Sepal.Width = 3 and Sepal.Length = 4? Is it because while using these values we see a better classifier while plotting the model?

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

      I found this
      From ?plot.svm
      slice a list of named numeric values for the dimensions held constant (only needed if more than two variables are used). Dimensions not specified are fixed at 0.
      In other words, when visualising the effect of predictor variables on the response you can specify which other predictor variables are to be hold constant (i.e. at a fixed value).
      So in your example, you're visualising the effect of the predictor variables Petal.Length and Petal.Width on the response while keeping Sepal.Width and Sepal.Length constant at the specified values

  • @ShubhamKumar-xy6kj
    @ShubhamKumar-xy6kj 4 года назад +1

    Sir,as kernel changes number of support vector change.Can this number be measure of accuracy of the model?

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

      For accuracy you should use info in the confusion matrix.

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

    So you only used the Petal length and width to do the svm test and ignored the Spetal characteristics ? Or did they affect the algorithm ?

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

      The others can be tried in the same way.

  • @praveenparmar7728
    @praveenparmar7728 5 лет назад

    Its very pretty, sir please share the link of R script

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

    Hi why are you doing the typical training and test data in this case?

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

      That can be easily done here too.

  • @saikiran-fc8xc
    @saikiran-fc8xc 4 года назад +1

    SVM separate those factor levels like a cluster? If it is so why are having those many vectors?

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

      It's outcome of the algorithm and depends on type of data.

  • @kalyanasundaramsp8267
    @kalyanasundaramsp8267 6 лет назад

    sorry typo in the previous question, for discrete independent variables, can we use them as factors in our model

    • @bkrai
      @bkrai  6 лет назад

      Factor variables are usually of "nominal" type. For definitions you can use this link:
      ruclips.net/video/1hF0x7WsVOI/видео.html

  • @adedayoadeyemi7671
    @adedayoadeyemi7671 7 лет назад +1

    thank so much for this video sir....can i apply this to a Raster image (i.e., Array) and could you please share the R script as well sir

    • @bkrai
      @bkrai  7 лет назад

      it depends on what type of data you have, no harm in trying. Here is the link to R code:
      drive.google.com/open?id=0B5W8CO0Gb2GGc1ZZQWhmMmpuWWc

    • @adedayoadeyemi7671
      @adedayoadeyemi7671 7 лет назад

      Ok sir, thanks sir..... do u also have videos on KNN, Naive bayes and R codes for ROC, PCA and Multiple linear regression

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

      @@bkrai thank you so much guru ji

  • @kalyanasundaramsp8267
    @kalyanasundaramsp8267 6 лет назад

    sir, cost function = should it always start from 2 or we can have 3 to the power of ?

    • @bkrai
      @bkrai  6 лет назад

      with 2 square, we start at cost value of 4 and then go to 8, 16, etc.. With 3 square, it will start at 9 and then jump to 27, 81, etc. But you can try it and see if it helps or not.

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

    Many thanks sir,thank you!I have a question for you. In the following statement: "mymodel

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

      It's because of 2D plot only 2 variables can be accommodated.

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

      @@bkrai Thanks for the answer

    • @dr.bheemsainik4316
      @dr.bheemsainik4316 2 года назад

      @@bkrai Sir, you have assigned constant values for other variables. how you have decided those constant values sir?

  • @akkimalhotra26
    @akkimalhotra26 7 лет назад

    Sir, I am getting the following error. could you say what can be done
    > plot(mymodel, data = iris,
    + Petal.Width~Petal.Length,
    + slice = list(Sepal.Width = 3, Sepal.length = 4))
    Error in `[.data.frame`(expand.grid(lis), , labels(terms(x))) :
    undefined columns selected

    • @bkrai
      @bkrai  7 лет назад

      I see a typo in Sepal.length = 4
      use "L" in length.

  • @raniash3ban383
    @raniash3ban383 6 лет назад +2

    very wonderful and useful
    i have a problem in install package in R can you help me
    the problem is [ unable to install packages (default library 'c:/program files/r/r-3.4.3/library' is not writeable)]

    • @bkrai
      @bkrai  6 лет назад

      probably you can restart RStudio and retry installing the package.

    • @raniash3ban383
      @raniash3ban383 6 лет назад

      thanks

  • @asmam-k7150
    @asmam-k7150 4 года назад +1

    Hello sir! This was very helpful thank you so much.. Can you please tell me how to split the data into train and test because I didn't understand quite well how you split the data here.. Or if there is a link to w pervious tutorial.. Thank you so much

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

      Here is a link that has more details:
      ruclips.net/p/PL34t5iLfZddspfUiv-9EaOVNUG64_fwFq

    • @asmam-k7150
      @asmam-k7150 4 года назад

      Thank you 😁

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

      welcome!

  • @FunTime-hq9ce
    @FunTime-hq9ce 5 лет назад +1

    how qplot done
    if we more number of variable then what can I use qplot

    • @bkrai
      @bkrai  5 лет назад

      In a scatter plot, we can only have two numeric variables at a time. If you have more variables, select two most important and see if they are helping to classify response or not.

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

    Is there any way to extract varibale importance in SVM ?. If so could you please suggest how to do that. Thanks

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

      You can try feature extraction using the link below before doing svm:
      ruclips.net/video/VEBax2WMbEA/видео.html

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

      Dr. Bharatendra Rai Thanks.

  • @muhammadhamzahm1204
    @muhammadhamzahm1204 5 лет назад +1

    Good

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

    Thanks again, sir! please upload the R file sir.

  • @NAMHAIDORJ830
    @NAMHAIDORJ830 7 лет назад +1

    hi how to work with high frequency data with SVM, thanks

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

      From high frequency data you can extract features and then use svm.

  • @dhanashreedeshpande7100
    @dhanashreedeshpande7100 7 лет назад

    ROC Curve & AUC value Demo should be here

    • @bkrai
      @bkrai  7 лет назад

      You can find them here: ruclips.net/video/ypO1DPEKYFo/видео.html

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

    Sir I have one question. Why didn't you divide the data into train and test.

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

      Since it was already a part of many videos, I try to focus just on SVM. But you are right, it's always better to partition the dataset.

  • @louaguilar890
    @louaguilar890 5 лет назад

    Error in svm.default(x, y, scale = scale, ..., na.action = na.action) :
    Need numeric dependent variable for regression.
    why do I always get this error whenever I'm using this formula?
    mymodel

    • @bkrai
      @bkrai  5 лет назад

      What is dependent variable in your data?

    • @louaguilar890
      @louaguilar890 5 лет назад

      Thank you for your response. I also tried the iris data and follow the tutorial, but still got the same error.

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

    Thanks. Why the iris data is not partitioned to train and test in this tutorial?

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

      I did it to keep length of the video small. But data partitioning should be done for all machine learning methods.

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

      @@bkrai Thanks Sir.

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

      welcome!

    • @asmam-k7150
      @asmam-k7150 4 года назад +1

      Hello sir! This was very helpful thank you so much.. Can you please tell me how to split the data into train and test because I didn't understand quite well how you split the data here.. Or if there is a link to w pervious tutorial.. Thank you so much

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

      @@asmam-k7150 You can see ruclips.net/video/RLjSQdcg8AM/видео.html

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

    Every time I try to plot after running the SVM model
    > plot(SVM Model name, data = data file name, Y axis variable~X axis variable)
    I get this error:
    > Error in Summary.factor(c(26L, 20L, 50L, 29L, 33L, 43L, 29L, 9L, 3L, 10L, :
    ‘min’ not meaningful for factors
    How do I correct this error?

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

      Instead of factor, use a numeric variable.

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

      @@bkrai But Dependent variable is binary , so I have to say factor, isnt it? Even in your video, species is factor.

  • @kapilkaramchandani5471
    @kapilkaramchandani5471 5 лет назад +1

    My dataset is multi variable how can i apply svm on it, can u help me??

    • @bkrai
      @bkrai  5 лет назад

      What do you mean by multi variable? Does it mean more than one variable? If yes, then you should have no problem applying svm.

    • @muharremakcora4361
      @muharremakcora4361 5 лет назад

      @@bkrai R is telling me "all arguments must have the same length" how can I solve this problem ?

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

    My data is qualitative it contains all variables are categorical...is svm applicable to my data??

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

      Try random forest.

  • @bharathjc4700
    @bharathjc4700 6 лет назад

    what is set.seed ?how do we decide set .seed value?

    • @bkrai
      @bkrai  6 лет назад

      you can choose any number you like. And then you can use that same number when you try to repeat analysis with same results.

  • @chd9841
    @chd9841 6 лет назад +1

    That music....kept me awake

  • @dr.divyasrivastava2820
    @dr.divyasrivastava2820 6 лет назад +1

    tab

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

      Make sure pred and actual have same number of data points.

  • @NIRAV2954
    @NIRAV2954 6 лет назад +1

    where can i find your r code ???

    • @bkrai
      @bkrai  6 лет назад +2

      Here is the link:
      drive.google.com/open?id=0B5W8CO0Gb2GGc1ZZQWhmMmpuWWc

  • @BigBrother4Life
    @BigBrother4Life 2 года назад +1

    Why this was not divided into test/train?

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

      Here just illustrated how to do SVM in R. But you are 100% correct, if you are applying it to any problem, make sure to split data in test/train.

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

      @@bkrai thank you sir for your response. Also if you could answere, i tried this on pima indian diabetes dataset (very famous); except for sigmoid I coudn't see colored boundaries (+ve and -ve catagory) for any other function and the misclassification error is least for linear, yet the algorithm (your method to find out best function) says that radial is the best one, can you guess what could be happening under the hood?

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

    Sir, please attach R command file.