R, Caret: how do I specify train and holdout (validation) sets? -


I have a data set and need to be cared for only to train and valid on a particular part of my data set. I have two lists:

  train.ids & lt; - List (T1 = C (1,2,3), T2 = C (4,5,6), T3 = C (7, 89))  

and

  test.ids & lt; - List (T1 = C (10,11,12), T2 = C (13,14,15), T3 = (16,17,18))  

Which The row index matches my data set. train.ids $ T1 should be used for training, while test.ids $ T1 should be used for testing. This also goes for T2 and T3.

  trainControl (method = "cv", index = train.ids, indexOut = test.ids)  

but it's the train's control Not the right way to use.

Any help is highly appreciated

Has any errors occurred? I'm not sure why this will not work here. Here's an example:

  Library (Charit) ## Set up a small data set example.seed (2) dat & lt; - twoClassSim (9) [, 13: 16] fit_on & lt; - List (rs1 = 1: 3, rs2 = 4: 6, rs3 = 7: 9) pred_on & lt; - List (rs1 = 4: 9, rs2 = c (1: 3, 7: 9), rs3 = 1: 6) Ctrl & lt; - trainControl (method = "cv", ## method does not really matter, because we are defining resamples index = fit_on, indexOut = pred_on, verboseIter = TRUE, saving events = TRUE) mod & lt; - Take a look at  mod $ pred  and you can see whether (class ~., Data = data, method = "LDA", trControl = ctrl)  
< P> was predicted on each recurrence

Maximum


Comments

Popular posts from this blog

import - Python ImportError: No module named wmi -

Editing Python Class in Shell and SQLAlchemy -

c# - MySQL Parameterized Select Query joining tables issue -