Adjustments / fixes... And add knn for regression
[agghoo.git] / man / Model.Rd
1 % Generated by roxygen2: do not edit by hand
2 % Please edit documentation in R/R6_Model.R
3 \name{Model}
4 \alias{Model}
5 \title{R6 class representing a (generic) model.}
6 \description{
7 "Model" class, containing a (generic) learning function, which from
8 data + target [+ params] returns a prediction function X --> y.
9 Parameters for cross-validation are either provided or estimated.
10 Model family can be chosen among "rf", "tree", "ppr" and "knn" for now.
11 }
12 \section{Public fields}{
13 \if{html}{\out{<div class="r6-fields">}}
14 \describe{
15 \item{\code{nmodels}}{Number of parameters (= number of [predictive] models)}
16 }
17 \if{html}{\out{</div>}}
18 }
19 \section{Methods}{
20 \subsection{Public methods}{
21 \itemize{
22 \item \href{#method-new}{\code{Model$new()}}
23 \item \href{#method-get}{\code{Model$get()}}
24 \item \href{#method-clone}{\code{Model$clone()}}
25 }
26 }
27 \if{html}{\out{<hr>}}
28 \if{html}{\out{<a id="method-new"></a>}}
29 \if{latex}{\out{\hypertarget{method-new}{}}}
30 \subsection{Method \code{new()}}{
31 Create a new generic model.
32 \subsection{Usage}{
33 \if{html}{\out{<div class="r">}}\preformatted{Model$new(data, target, task, gmodel = NULL, params = NULL)}\if{html}{\out{</div>}}
34 }
35
36 \subsection{Arguments}{
37 \if{html}{\out{<div class="arguments">}}
38 \describe{
39 \item{\code{data}}{Matrix or data.frame}
40
41 \item{\code{target}}{Vector of targets (generally numeric or factor)}
42
43 \item{\code{task}}{"regression" or "classification"}
44
45 \item{\code{gmodel}}{Generic model returning a predictive function; chosen
46 automatically given data and target nature if not provided.}
47
48 \item{\code{params}}{List of parameters for cross-validation (each defining a model)}
49 }
50 \if{html}{\out{</div>}}
51 }
52 }
53 \if{html}{\out{<hr>}}
54 \if{html}{\out{<a id="method-get"></a>}}
55 \if{latex}{\out{\hypertarget{method-get}{}}}
56 \subsection{Method \code{get()}}{
57 Returns the model at index "index", trained on dataHO/targetHO.
58 index is between 1 and self$nmodels.
59 \subsection{Usage}{
60 \if{html}{\out{<div class="r">}}\preformatted{Model$get(dataHO, targetHO, index)}\if{html}{\out{</div>}}
61 }
62
63 \subsection{Arguments}{
64 \if{html}{\out{<div class="arguments">}}
65 \describe{
66 \item{\code{dataHO}}{Matrix or data.frame}
67
68 \item{\code{targetHO}}{Vector of targets (generally numeric or factor)}
69
70 \item{\code{index}}{Index of the model in 1...nmodels}
71 }
72 \if{html}{\out{</div>}}
73 }
74 }
75 \if{html}{\out{<hr>}}
76 \if{html}{\out{<a id="method-clone"></a>}}
77 \if{latex}{\out{\hypertarget{method-clone}{}}}
78 \subsection{Method \code{clone()}}{
79 The objects of this class are cloneable with this method.
80 \subsection{Usage}{
81 \if{html}{\out{<div class="r">}}\preformatted{Model$clone(deep = FALSE)}\if{html}{\out{</div>}}
82 }
83
84 \subsection{Arguments}{
85 \if{html}{\out{<div class="arguments">}}
86 \describe{
87 \item{\code{deep}}{Whether to make a deep clone.}
88 }
89 \if{html}{\out{</div>}}
90 }
91 }
92 }