partition_cv creates a represampling object for length(repetition)-repeated nfold-fold cross-validation.

Details

This function does not actually perform a cross-validation or partition the data set itself; it simply creates a data structure containing the indices of training and test samples.

mlr3spatiotempcv notes

The 'Description' and 'Details' fields are inherited from the respective upstream function.

For a list of available arguments, please see sperrorest::partition_cv.

References

Brenning A (2012). “Spatial cross-validation and bootstrap for the assessment of prediction rules in remote sensing: The R package sperrorest.” In 2012 IEEE International Geoscience and Remote Sensing Symposium. doi: 10.1109/igarss.2012.6352393 .

Super class

mlr3::Resampling -> ResamplingSpCVCoords

Active bindings

iters

integer(1)
Returns the number of resampling iterations, depending on the values stored in the param_set.

Methods

Public methods

Inherited methods

Method new()

Create an "coordinate-based" repeated resampling instance.

For a list of available arguments, please see sperrorest::partition_cv.

Usage

ResamplingSpCVCoords$new(id = "spcv_coords")

Arguments

id

character(1)
Identifier for the resampling strategy.


Method instantiate()

Materializes fixed training and test splits for a given task.

Usage

ResamplingSpCVCoords$instantiate(task)

Arguments

task

Task
A task to instantiate.


Method clone()

The objects of this class are cloneable with this method.

Usage

ResamplingSpCVCoords$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.

Examples

library(mlr3) task = tsk("ecuador") # Instantiate Resampling rcv = rsmp("spcv_coords", folds = 5) rcv$instantiate(task) # Individual sets: rcv$train_set(1)
#> [1] 2 3 4 5 10 18 19 26 28 29 37 39 45 48 49 50 57 58 #> [19] 61 64 68 77 85 89 90 103 106 110 115 120 122 125 126 127 129 131 #> [37] 133 135 136 138 150 151 153 155 158 169 170 172 183 190 201 203 206 207 #> [55] 216 218 219 220 222 227 231 234 236 238 243 245 255 260 263 265 268 271 #> [73] 272 281 289 290 303 309 317 325 344 345 346 349 350 356 357 358 362 370 #> [91] 372 373 385 394 400 403 404 405 412 413 414 422 423 426 427 428 429 442 #> [109] 444 449 453 455 460 463 464 470 474 476 483 486 487 490 492 502 503 509 #> [127] 510 518 523 525 528 529 531 544 557 562 564 573 575 585 592 594 596 612 #> [145] 613 623 628 634 641 642 643 644 649 653 655 661 664 673 690 693 706 707 #> [163] 708 710 712 715 718 724 727 728 732 733 735 736 737 739 743 746 7 8 #> [181] 12 13 14 15 17 21 24 25 32 35 44 46 54 63 65 66 75 78 #> [199] 79 86 88 91 94 97 104 105 109 113 118 123 128 130 132 137 140 142 #> [217] 143 145 147 161 162 163 166 171 181 182 188 191 192 195 196 200 202 204 #> [235] 209 211 213 214 215 221 223 224 225 229 240 242 246 251 253 259 261 262 #> [253] 266 270 277 279 280 282 285 287 288 305 306 308 313 318 320 322 327 331 #> [271] 336 337 338 348 354 365 366 368 371 377 378 381 384 388 395 402 406 409 #> [289] 411 416 418 430 431 433 435 446 448 451 452 458 461 465 468 472 475 477 #> [307] 478 480 488 493 494 496 498 499 505 511 512 527 532 533 535 538 541 542 #> [325] 543 554 555 558 559 561 563 566 567 570 580 581 583 586 591 598 599 602 #> [343] 607 611 617 618 619 621 631 636 638 646 651 658 663 667 671 680 681 683 #> [361] 684 691 701 703 705 714 720 723 726 730 734 740 747 750 9 20 22 27 #> [379] 30 31 38 40 41 43 53 67 69 70 71 72 73 74 80 81 82 83 #> [397] 92 98 101 102 108 114 116 119 124 134 141 154 159 160 173 176 177 179 #> [415] 180 185 186 187 189 194 197 199 205 208 217 226 228 233 235 237 244 247 #> [433] 254 275 276 278 284 291 292 293 296 298 299 301 304 311 315 323 326 328 #> [451] 333 334 335 339 340 341 343 352 353 355 359 360 367 380 386 389 390 392 #> [469] 396 398 401 415 434 436 437 438 441 443 450 454 456 457 462 467 479 484 #> [487] 489 495 500 506 508 513 519 520 521 522 526 530 536 547 551 556 565 568 #> [505] 574 576 579 582 587 589 593 595 597 600 601 603 605 606 608 610 614 615 #> [523] 616 622 625 633 648 656 659 668 670 672 675 679 685 694 697 709 713 717 #> [541] 719 722 725 738 1 6 11 16 23 33 34 36 51 56 84 100 107 111 #> [559] 112 117 146 148 149 164 165 167 168 174 175 178 184 193 198 210 212 232 #> [577] 248 252 256 257 258 264 273 286 294 295 297 302 307 310 312 314 316 324 #> [595] 330 342 347 351 361 363 364 369 374 379 382 387 391 393 399 407 410 420 #> [613] 421 425 432 439 445 447 459 466 469 471 481 482 485 491 497 507 515 517 #> [631] 524 545 549 572 577 584 590 609 624 626 629 632 640 645 647 660 677 678 #> [649] 687 695 699 700 721 731 742 745
rcv$test_set(1)
#> [1] 42 47 52 55 59 60 62 76 87 93 95 96 99 121 139 144 152 156 157 #> [20] 230 239 241 249 250 267 269 274 283 300 319 321 329 332 375 376 383 397 408 #> [39] 417 419 424 440 473 501 504 514 516 534 537 539 540 546 548 550 552 553 560 #> [58] 569 571 578 588 604 620 627 630 635 637 639 650 652 654 657 662 665 666 669 #> [77] 674 676 682 686 688 689 692 696 698 702 704 711 716 729 741 744 748 749 751
# check that no obs are in both sets intersect(rcv$train_set(1), rcv$test_set(1)) # good!
#> integer(0)
# Internal storage: rcv$instance # table
#> row_id fold #> 1: 42 1 #> 2: 47 1 #> 3: 52 1 #> 4: 55 1 #> 5: 59 1 #> --- #> 747: 700 5 #> 748: 721 5 #> 749: 731 5 #> 750: 742 5 #> 751: 745 5