FunctionalModel.fit.transformed: Fit the Given Model Blueprint to the Specified Data

Description Usage Arguments Value Examples

Description

Fit the specified model to the given data. First, we generate a starting guess about the parameterization via FunctionalModel.par.estimate (or accept it via the parameter par). From then on, we apply the different function fitters one by one. All the fitters who have not produced the current best solution are applied again, to the now-best guess. However, we do not apply the fitters that have produced that very guess in the next round. (They may get a chance again in a later turn.) Anyway, this procedure is iterated until no improvement can be made anymore. After finishing the fitting, we attempt whether rounding the fitted parameters to integers can improve the fitting quality.

Usage

1
2
3
FunctionalModel.fit.transformed(metric, model, transformation.x = NULL,
  transformation.y = NULL, metric.transformed = NULL, par = NULL,
  q = 0.75, fitter = FunctionalModel.fit)

Arguments

metric

an instance of RegressionQualityMetric

model

an instance of FunctionalModel

transformation.x

the transformation along the x-axis, or NULL if none was applied to the data

transformation.y

the transformation along the y-axis, or NULL if none was applied to the data

metric.transformed

the transformed metric for the first fitting step

par

the initial starting point

q

the effort to spent in learning, a value between 0 (min) and 1 (max). Higher values may lead to much more computational time, lower values to potentially lower result quality.

fitter

the model fitter to use

Value

On success, an instance of FittedFunctionalModel. NULL on failure.

Examples

 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
set.seed(234345L)

orig.f.x.par <- function(x, par) exp(par[1] + par[2]*x - par[3]*x*x);
orig.par <- c(0.2, -0.3, 0.4);
orig.f.x <- function(x) orig.f.x.par(x, orig.par);
orig.x <- (-100:100)*0.05;
orig.y <- orig.f.x(orig.x);
noisy.x <- rnorm(n=length(orig.x), mean=orig.x, sd=0.05);
noisy.y <- rnorm(n=length(orig.y), mean=orig.y, sd=0.05*orig.y);

transformed.data <- dataTransformeR::TransformedData2D.new(
  dataTransformeR::Transformation.normalize(noisy.x),
  dataTransformeR::Transformation.log(noisy.y));

metric <- regressoR.quality::RegressionQualityMetric.default(noisy.x, noisy.y);
metric.transformed <- regressoR.quality::RegressionQualityMetric.default(
                                                 transformed.data@x@data,
                                                 transformed.data@y@data);
model <- regressoR.functional.models::FunctionalModel.quadratic();
result <- FunctionalModel.fit.transformed(metric, model,
                                transformed.data@x@transformation,
                                transformed.data@y@transformation,
                                metric.transformed);

result.2 <- learnerSelectoR::learning.Result.finalize(result)
plot(noisy.x, noisy.y)
lines(noisy.x, result.2@f(noisy.x), col="red")

thomasWeise/regressoR.functional documentation built on May 10, 2019, 10:24 a.m.