Cross validation in R with the caret library

Поделиться
HTML-код
  • Опубликовано: 11 сен 2024
  • Download the code at:
    github.com/mar...

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

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

    Also, Do you know if it is possible to change de parameter "distance" of knn while I'm still using the function train() to build the model as you did? I would like to test different distances in the algorithm like for example, euclidian, manhattan..

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

      I don't know either, but it's a good point. Manhattan distance is sometimes the best choice.

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

    How can I use loocv for the Stacking Algorithms using R? Need to save prediction and I use caretList with 'rpart', 'knn', 'nb'

  • @md.akibal-zubayer2104
    @md.akibal-zubayer2104 2 года назад

    This video is really helpful. Can you help me a little bit more ?. I am trying different method at the same time. How can I use repeated cv for random forest, svm and neural network here ?

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

    The parameter:
    "tuneGrid =data.frame(k=seq(5,100,by=15))) # Try only these values in the CV step
    # tuneLength = 25) # Use 25 sequential numbers instead"
    you are testing different numbers of k-folds for cross-validation, or different numbers of k-neighbors? sorry I didn't understand the difference..

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

      tuneGrid allows you to choose the values explicitly. tuneLength only tries with 25 values in the default interval (that varies from function to function and sometimes doesn't span all the "interesting" parameters).

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

      I believe it’s different numbers of k-neighbors

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

    How do we get the caret snippet ?

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

      Download it here: github.com/mariocastro73/ML2020-2021/blob/master/scripts/caret.snippet and plug it into the section for snippets in Rstudio

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

      How to use CV for logistic regression

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

      @@arungandhi5612 Same as in minute 2:40 but knn -> glm and add familiy='binomial'

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

      @@MarioCastroPonce thanks Mario , this snippet is of great help

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

      @@arungandhi5612 cheers