/
BaselearnerPSpline.Rd
94 lines (78 loc) · 2.5 KB
/
BaselearnerPSpline.Rd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/RcppExports.R
\name{BaselearnerPSpline}
\alias{BaselearnerPSpline}
\title{Base-learner factory to do non-parametric B or P-spline regression}
\format{
\code{\link{S4}} object.
}
\description{
\code{BaselearnerPSpline} creates a spline base-learner factory
object which can be registered within a base-learner list and then used
for training.
}
\section{Usage}{
\preformatted{
BaselearnerPSpline$new(data_source, data_target, list(degree, n_knots, penalty,
differences))
}
}
\section{Arguments}{
\describe{
\item{\code{data_source} [\code{Data} Object]}{
Data object which contains the source data.
}
\item{\code{data_target} [\code{Data} Object]}{
Data object which gets the transformed source data.
}
\item{\code{degree} [\code{integer(1)}]}{
Degree of the spline functions to interpolate the knots.
}
\item{\code{n_knots} [\code{integer(1)}]}{
Number of \strong{inner knots}. To prevent weird behavior on the edges
the inner knots are expanded by \eqn{\mathrm{degree} - 1} additional knots.
}
\item{\code{penalty} [\code{numeric(1)}]}{
Positive numeric value to specify the penalty parameter. Setting the
penalty to 0 ordinary B-splines are used for the fitting.
}
\item{\code{differences} [\code{integer(1)}]}{
The number of differences which are penalized. A higher value leads to
smoother curves.
}
}
}
\section{Details}{
The data matrix of the source data is restricted to have just one column.
The spline bases are created for this single feature. Multidimensional
splines are not supported at the moment.
}
\section{Fields}{
This class doesn't contain public fields.
}
\section{Methods}{
\describe{
\item{\code{getData()}}{Get the data matrix of the target data which is used
for modeling.}
\item{\code{transformData(X)}}{Transform a data matrix as defined within the
factory. The argument has to be a matrix with one column.}
\item{\code{summarizeFactory()}}{Summarize the base-learner factory object.}
}
}
\examples{
# Sample data:
data_mat = cbind(1:10)
y = sin(1:10)
# Create new data object:
data_source = InMemoryData$new(data_mat, "my_data_name")
data_target = InMemoryData$new()
# Create new linear base-learner:
spline_factory = BaselearnerPSpline$new(data_source, data_target,
list(degree = 3, n_knots = 4, penalty = 2, differences = 2))
# Get the transformed data:
spline_factory$getData()
# Summarize factory:
spline_factory$summarizeFactory()
# Transform data manually:
spline_factory$transformData(data_mat)
}