Description Usage Arguments Value Examples
Use the learnerSelectoR
package to apply a set of
learners to a set of data representations and pick the approach which
generalizes best.
The data is represented by two vectors, x
and y
.
Each learner must be function with exactly four arguments named
metric
, transformation.x
, transformation.y
, and
metric.transformed
Its parameter metric
will be an instance
of RegressionQualityMetric
which guides the search on the
actual, raw data. However, since we internally use the
Transformation.applyDefault2D
method from the
dataTransformeR
package by default to generate different
representations of the raw data, each model fitting procedure may take
place in two steps, first on a transformed representation of the data
(metric.transformed
based on transformation.x
and
transformation.y
) and then the actual finalization fitting the
actual metric
.
A learner returns an instance of FittedModel
which
represents, well, the model it has fitted to its input data. Each learner
thus represents the process of adapting a specific model to some data.
By default, this method uses all the learners which are generated by
regressoR.defaultLearners
.
The metricGenerator
is a function which accepts two vectors x
and y
and returns an instance of
RegressionQualityMetric
. It will be used to generate the
quality metrics for guiding the model fitters. Since we internally use the
learning.learn
method from the learnerSelectoR
package, the model may be chosen based on cross-validation and the metric
generator is then also used to generate quality metrics for the training
and test datasets used internally. If nothing else is specified, we use
RegressionQualityMetric.default
to generate the quality
metrics.
representations
is a list of TransformedData2D
instances providing alernative views on the data, or NULL
if only
the raw data should be concerned. By default, we use
Transformation.applyDefault2D
to get a set of representations
if nothing else is specified.
The return value of this method will be an instance of
FittedModel
or NULL
if no learner could produce any
result.
1 2 3 | regressoR.learn(x, y, learners = regressoR.defaultLearners(),
representations = Transformation.applyDefault2D(x = x, y = y, addIdentity =
TRUE), metricGenerator = RegressionQualityMetric.default, q = 0.75)
|
x |
the |
y |
the |
learners |
the learners to apply |
representations |
the list of data representations, or |
metricGenerator |
the metric generator function |
q |
the effort parameter: 0=minimum effort=fast/low quality, 1=maximum effort=slow=highest quality |
an instance of FittedModel
which represents the
relationship between the x
and y
values
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | ## Not run:
dx <- rnorm(100);
dy <- rnorm(n=100, mean=50*dx*dx-33);
plot(dx, dy)
result <- regressoR.learn(x=dx, y=dy);
result@f
# function (x)
# -32.5442186855071 + (x * (0.776119279549966 + (x * 49.7907873618706)))
result@quality
# [1] 0.2455075
dx.sorted <- sort(dx)
lines(dx.sorted, result@f(dx.sorted), col="red")
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.