% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/ResamplingCustom.R
\name{mlr_resamplings_custom}
\alias{mlr_resamplings_custom}
\alias{ResamplingCustom}
\title{Custom Resampling}
\description{
Splits data into training and test sets using manually provided indices.
}
\section{Dictionary}{

This \link{Resampling} can be instantiated via the \link[mlr3misc:Dictionary]{dictionary} \link{mlr_resamplings} or with the associated sugar function \code{\link[=rsmp]{rsmp()}}:

\if{html}{\out{<div class="sourceCode">}}\preformatted{mlr_resamplings$get("custom")
rsmp("custom")
}\if{html}{\out{</div>}}
}

\examples{
# Create a task with 10 observations
task = tsk("penguins")
task$filter(1:10)

# Instantiate Resampling
custom = rsmp("custom")
train_sets = list(1:5, 5:10)
test_sets = list(5:10, 1:5)
custom$instantiate(task, train_sets, test_sets)

custom$train_set(1)
custom$test_set(1)
}
\seealso{
\itemize{
\item Chapter in the \href{https://mlr3book.mlr-org.com/}{mlr3book}:
\url{https://mlr3book.mlr-org.com/chapters/chapter3/evaluation_and_benchmarking.html#sec-resampling}
\item Package \CRANpkg{mlr3spatiotempcv} for spatio-temporal resamplings.
\item \link[mlr3misc:Dictionary]{Dictionary} of \link[=Resampling]{Resamplings}: \link{mlr_resamplings}
\item \code{as.data.table(mlr_resamplings)} for a table of available \link[=Resampling]{Resamplings} in the running session (depending on the loaded packages).
\item \CRANpkg{mlr3spatiotempcv} for additional \link{Resampling}s for spatio-temporal
tasks.
}

Other Resampling:
\code{\link{Resampling}},
\code{\link{mlr_resamplings}},
\code{\link{mlr_resamplings_bootstrap}},
\code{\link{mlr_resamplings_custom_cv}},
\code{\link{mlr_resamplings_cv}},
\code{\link{mlr_resamplings_holdout}},
\code{\link{mlr_resamplings_insample}},
\code{\link{mlr_resamplings_loo}},
\code{\link{mlr_resamplings_repeated_cv}},
\code{\link{mlr_resamplings_subsampling}}
}
\concept{Resampling}
\section{Super class}{
\code{\link[mlr3:Resampling]{Resampling}} -> \code{ResamplingCustom}
}
\section{Active bindings}{
  \if{html}{\out{<div class="r6-active-bindings">}}
  \describe{
    \item{\code{iters}}{(\code{integer(1)})\cr
Returns the number of resampling iterations, depending on the values stored in the \code{param_set}.}
  }
  \if{html}{\out{</div>}}
}
\section{Methods}{
\subsection{Public methods}{
  \itemize{
    \item \href{#method-ResamplingCustom-initialize}{\code{ResamplingCustom$new()}}
    \item \href{#method-ResamplingCustom-instantiate}{\code{ResamplingCustom$instantiate()}}
    \item \href{#method-ResamplingCustom-clone}{\code{ResamplingCustom$clone()}}
  }
}
\if{html}{\out{<details open><summary>Inherited methods</summary>
<ul>
  <li><span class="pkg-link" data-pkg="mlr3" data-topic="Resampling" data-id="format"><a href='../../mlr3/html/Resampling.html#method-Resampling-format'><code>Resampling$format()</code></a></span></li>
  <li><span class="pkg-link" data-pkg="mlr3" data-topic="Resampling" data-id="help"><a href='../../mlr3/html/Resampling.html#method-Resampling-help'><code>Resampling$help()</code></a></span></li>
  <li><span class="pkg-link" data-pkg="mlr3" data-topic="Resampling" data-id="print"><a href='../../mlr3/html/Resampling.html#method-Resampling-print'><code>Resampling$print()</code></a></span></li>
  <li><span class="pkg-link" data-pkg="mlr3" data-topic="Resampling" data-id="test_set"><a href='../../mlr3/html/Resampling.html#method-Resampling-test_set'><code>Resampling$test_set()</code></a></span></li>
  <li><span class="pkg-link" data-pkg="mlr3" data-topic="Resampling" data-id="train_set"><a href='../../mlr3/html/Resampling.html#method-Resampling-train_set'><code>Resampling$train_set()</code></a></span></li>
</ul>
</details>}}
\if{html}{\out{<hr>}}
\if{html}{\out{<a id="method-ResamplingCustom-initialize"></a>}}
\if{latex}{\out{\hypertarget{method-ResamplingCustom-initialize}{}}}
\subsection{\code{ResamplingCustom$new()}}{
  Creates a new instance of this \link[R6:R6Class]{R6} class.
  \subsection{Usage}{
    \if{html}{\out{<div class="r">}}
    \preformatted{ResamplingCustom$new()}
    \if{html}{\out{</div>}}
  }
}

\if{html}{\out{<hr>}}
\if{html}{\out{<a id="method-ResamplingCustom-instantiate"></a>}}
\if{latex}{\out{\hypertarget{method-ResamplingCustom-instantiate}{}}}
\subsection{\code{ResamplingCustom$instantiate()}}{
  Instantiate this \link{Resampling} with custom splits into training and test set.
  \subsection{Usage}{
    \if{html}{\out{<div class="r">}}
    \preformatted{ResamplingCustom$instantiate(task, train_sets, test_sets)}
    \if{html}{\out{</div>}}
  }
  \subsection{Arguments}{
    \if{html}{\out{<div class="arguments">}}
    \describe{
      \item{\code{task}}{\link{Task}\cr
Mainly used to check if \code{train_sets} and \code{test_sets} are feasible.}
      \item{\code{train_sets}}{(list of \code{integer()})\cr
List with row ids for training, one list element per iteration.
Must have the same length as \code{test_sets}.}
      \item{\code{test_sets}}{(list of \code{integer()})\cr
List with row ids for testing, one list element per iteration.
Must have the same length as \code{train_sets}.}
    }
    \if{html}{\out{</div>}}
  }
}

\if{html}{\out{<hr>}}
\if{html}{\out{<a id="method-ResamplingCustom-clone"></a>}}
\if{latex}{\out{\hypertarget{method-ResamplingCustom-clone}{}}}
\subsection{\code{ResamplingCustom$clone()}}{
  The objects of this class are cloneable with this method.
  \subsection{Usage}{
    \if{html}{\out{<div class="r">}}
    \preformatted{ResamplingCustom$clone(deep = FALSE)}
    \if{html}{\out{</div>}}
  }
  \subsection{Arguments}{
    \if{html}{\out{<div class="arguments">}}
    \describe{
      \item{\code{deep}}{Whether to make a deep clone.}
    }
    \if{html}{\out{</div>}}
  }
}

}
