BaselearnerPSpline: Base-learner factory to do non-parametric B or P-spline...

Description Format Usage Arguments Details Fields Methods Examples

Description

BaselearnerPSpline creates a spline base-learner factory object which can be registered within a base-learner list and then used for training.

Format

S4 object.

Usage

1
2
BaselearnerPSpline$new(data_source, data_target, degree, n_knots, penalty,
  differences)

Arguments

data_source [Data Object]

Data object which contains the source data.

data_target [Data Object]

Data object which gets the transformed source data.

degree [integer(1)]

Degree of the spline functions to interpolate the knots.

n_knots [integer(1)]

Number of inner knots. To prevent weird behavior on the edges the inner knots are expanded by \mathrm{degree} - 1 additional knots.

penalty [numeric(1)]

Positive numeric value to specify the penalty parameter. Setting the penalty to 0 ordinary B-splines are used for the fitting.

differences [integer(1)]

The number of differences which are penalized. A higher value leads to smoother curves.

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.

This class is a wrapper around the pure C++ implementation. To see the functionality of the C++ class visit https://schalkdaniel.github.io/compboost/cpp_man/html/classblearnerfactory_1_1_p_spline_blearner_factory.html.

Fields

This class doesn't contain public fields.

Methods

getData()

Get the data matrix of the target data which is used for modeling.

transformData(X)

Transform a data matrix as defined within the factory. The argument has to be a matrix with one column.

summarizeFactory()

Summarize the base-learner factory object.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
# 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,
  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)

compboost documentation built on May 2, 2019, 6:40 a.m.