[R] Sporadic errors when training models using CARET

Max Kuhn mxkuhn at gmail.com
Tue Nov 23 16:03:24 CET 2010


Kendric,

I've seen these too and traceback() usually goes back to ksvm(). This
doesn't mean that the error is there, but the results fo traceback()
from you would be helpful.

thanks,

Max

On Mon, Nov 22, 2010 at 6:18 PM, Kendric Wang
<kendricw at interchange.ubc.ca> wrote:
> Hi. I am trying to construct a svmLinear model using the "caret" package
> (see code below). Using the same data, without changing any setting,
> sometimes it constructs the model successfully, and sometimes I get an index
> out of bounds error. Is this unexpected behaviour? I would appreciate any
> insights this issue.
>
>
> Thanks.
> ~Kendric
>
>
>> train.y
>  [1] S S S S R R R R R R R R R R R R R R R R R R R R
> Levels: R S
>
>> train.x
>        m1      m2
> 1   0.1756  0.6502
> 2   0.1110 -0.2217
> 3   0.0837 -0.1809
> 4  -0.3703 -0.2476
> 5   8.3825  2.8814
> 6   5.6400 12.9922
> 7   7.5537  7.4809
> 8   3.5005  5.7844
> 9  16.8541 16.6326
> 10  9.1851  8.7814
> 11  1.4405 11.0132
> 12  9.8795  2.6182
> 13  8.7151  4.5476
> 14 -0.2092 -0.7601
> 15  3.6876  2.5772
> 16  8.3776  5.0882
> 17  8.6567  7.2640
> 18 20.9386 20.1107
> 19 12.2903  4.7864
> 20 10.5920  7.5204
> 21 10.2679  9.5493
> 22  6.2023 11.2333
> 23 -5.0720 -4.8701
> 24  6.6417 11.5139
>
>> svmLinearGrid <- expand.grid(.C=0.1)
>> svmLinearFit <- train(train.x, train.y, method="svmLinear",
> tuneGrid=svmLinearGrid)
> Fitting: C=0.1
> Error in indexes[[j]] : subscript out of bounds
>
>> svmLinearFit <- train(train.x, train.y, method="svmLinear",
> tuneGrid=svmLinearGrid)
> Fitting: C=0.1
> maximum number of iterations reached 0.0005031579 0.0005026807maximum number
> of iterations reached 0.0002505857 0.0002506714Error in indexes[[j]] :
> subscript out of bounds
>
>> svmLinearFit <- train(train.x, train.y, method="svmLinear",
> tuneGrid=svmLinearGrid)
> Fitting: C=0.1
> maximum number of iterations reached 0.0003270061 0.0003269764maximum number
> of iterations reached 7.887867e-05 7.866367e-05maximum number of iterations
> reached 0.0004087571 0.0004087466Aggregating results
> Selecting tuning parameters
> Fitting model on full training set
>
>
> R version 2.11.1 (2010-05-31)
> x86_64-redhat-linux-gnu
>
> locale:
>  [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C
>  [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8
>  [5] LC_MONETARY=C              LC_MESSAGES=en_US.UTF-8
>  [7] LC_PAPER=en_US.UTF-8       LC_NAME=C
>  [9] LC_ADDRESS=C               LC_TELEPHONE=C
> [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
>
> attached base packages:
> [1] splines   stats     graphics  grDevices utils     datasets  methods
> [8] base
>
> other attached packages:
>  [1] kernlab_0.9-12  pamr_1.47       survival_2.35-8 cluster_1.12.3
>  [5] e1071_1.5-24    class_7.3-2     caret_4.70      reshape_0.8.3
>  [9] plyr_1.2.1      lattice_0.18-8
>
> loaded via a namespace (and not attached):
> [1] grid_2.11.1
>
>
> --
> MSc. Candidate
> CIHR/MSFHR Training Program in Bioinformatics
> University of British Columbia
>
>        [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



-- 

Max



More information about the R-help mailing list