Title: | Lazy Learning for Local Regression |
---|---|
Description: | By combining constant, linear, and quadratic local models, lazy estimates the value of an unknown multivariate function on the basis of a set of possibly noisy samples of the function itself. This implementation of lazy learning automatically adjusts the bandwidth on a query-by-query basis through a leave-one-out cross-validation. |
Authors: | Mauro Birattari <[email protected]> and Gianluca Bontempi <[email protected]> |
Maintainer: | Theo Verhelst <[email protected]> |
License: | GPL (>= 2) |
Version: | 1.2-18 |
Built: | 2025-02-18 05:56:26 UTC |
Source: | https://github.com/cran/lazy |
By combining constant, linear, and quadratic local models,
lazy
estimates the value of an unknown multivariate function on
the basis of a set of possibly noisy samples of the function itself.
This implementation of lazy learning automatically adjusts the
bandwidth on a query-by-query basis through a leave-one-out
cross-validation.
lazy(formula, data=NULL, weights, subset, na.action, control=lazy.control(...), ...)
lazy(formula, data=NULL, weights, subset, na.action, control=lazy.control(...), ...)
formula |
A formula specifying the response and some numeric predictors. |
data |
An optional data frame within which to look first for the response, predictors, and weights (the latter will be ignored). |
weights |
Optional weights for each case (ignored). |
subset |
An optional specification of a subset of the data to be used. |
na.action |
The action to be taken with missing values in the response or predictors. The default is to stop. |
control |
Control parameters: see |
.
... |
Control parameters can also be supplied directly. |
For one or more query points, lazy
estimates the value of
an unknown multivariate function on the basis of a set of possibly
noisy samples of the function itself. Each sample is an input/output
pair where the input is a vector and the output is a number. For each
query point, the estimation of the function is obtained by combining
different local models. Local models considered for combination by
lazy
are polynomials of zeroth, first, and second degree that
fit a set of samples in the neighborhood of the query point. The
neighbors are selected according to either the Manhattan or the
Euclidean distance. It is possible to assign weights to the different
directions of the input domain for modifying their importance in the
computation of the distance. The number of neighbors used for
identifying local models is automatically adjusted on a query-by-query
basis through a leave-one-out validations of models, each fitting a
different numbers of neighbors. The local models are identified using
the recursive least-squares algorithm, and the leave-one-out
cross-validation is obtained through the PRESS statistic.
As the name lazy
suggests, this function does not do
anything... apart from checking the options and properly packing
the data. All the actual computation is done when a prediction is
request for a specific query point, or for a set of query points: see
predict.lazy
.
An object of class lazy
.
Mauro Birattari and Gianluca Bontempi
D.W. Aha (1997) Editorial. Artificial Intelligence Review, 11(1–5), pp. 1–6. Special Issue on Lazy Learning.
C.G. Atkeson, A.W. Moore, and S. Schaal (1997) Locally Weighted Learning. Artificial Intelligence Review, 11(1–5), pp. 11–73. Special Issue on Lazy Learning.
W.S. Cleveland, S.J. Devlin, and S.J. Grosse (1988) Regression by Local Fitting: Methods, Prospectives and Computational Algorithms. Journal of Econometrics, 37, pp. 87–114.
M. Birattari, G. Bontempi, and H. Bersini (1999) Lazy learning meets the recursive least squares algorithm. Advances in Neural Information Processing Systems 11, pp. 375–381. MIT Press.
G. Bontempi, M. Birattari, and H. Bersini (1999) Lazy learning for modeling and control design. International Journal of Control, 72(7/8), pp. 643–658.
G. Bontempi, M. Birattari, and H. Bersini (1999) Local learning for iterated time-series prediction. International Conference on Machine Learning, pp. 32–38. Morgan Kaufmann.
library("lazy") data(cars) cars.lazy <- lazy(dist ~ speed, cars) predict(cars.lazy, data.frame(speed = seq(5, 30, 1)))
library("lazy") data(cars) cars.lazy <- lazy(dist ~ speed, cars) predict(cars.lazy, data.frame(speed = seq(5, 30, 1)))
Set control parameters for a lazy learning object.
lazy.control(conIdPar=NULL, linIdPar=1, quaIdPar=NULL, distance=c("manhattan","euclidean"), metric=NULL, cmbPar=1, lambda=1e+06)
lazy.control(conIdPar=NULL, linIdPar=1, quaIdPar=NULL, distance=c("manhattan","euclidean"), metric=NULL, cmbPar=1, lambda=1e+06)
conIdPar |
Parameter controlling the number of neighbors to be used
for identifying and validating constant models.
|
linIdPar |
Parameter controlling the number of neighbors to be used
for identifying and validating linear models.
|
quaIdPar |
Parameter controlling the number of neighbors to be
used for identifying and validating quadratic
models.
|
distance |
The distance metric: can be |
metric |
Vector of |
cmbPar |
Parameter controlling the local combination of
models.
|
lambda |
Initialization of the diagonal elements of the local variance/covariance matrix for Ridge Regression. |
The output of lazy.control
is a list containing the
following components: conIdPar
, linIdPar
, quaIdPar
,
distance
, metric
, cmbPar
, lambda
.
Mauro Birattari and Gianluca Bontempi
Obtains predictions from a lazy learning object
## S3 method for class 'lazy' predict(object, newdata=NULL, t.out=FALSE, k.out=FALSE, S.out=FALSE, T.out=FALSE, I.out=FALSE, ...)
## S3 method for class 'lazy' predict(object, newdata=NULL, t.out=FALSE, k.out=FALSE, S.out=FALSE, T.out=FALSE, I.out=FALSE, ...)
object |
Object of class inheriting from |
newdata |
Data frame (or matrix, vector, etc...) defining of the query points for which a prediction is to be produced. |
t.out |
Logical switch indicating if the function should return the parameters of the local models used to perform each estimation. |
k.out |
Logical switch indicating if the function should return the number of neighbors used to perform each estimation. |
S.out |
Logical switch indicating if the function should return the estimated variance of the prediction suggested by all the models identified for each query point. |
T.out |
Logical switch indicating if the function should return the parameters of all the models identified for each query point. |
I.out |
Logical switch indicating if the function should return
the index |
... |
Arguments passed to or from other methods. |
The output of the method is a list containing the following components:
h |
Vector of |
t |
Matrix of |
k |
Vector of |
S |
List of up to 3 components: Each component is a matrix containing an estimate, obtained through a leave-one-out cross-valication, of the variance of local models.
The component |
T |
List of up to 3 components:
REMARK: a translation of the axes is considered
which centers all the local models in the respective query
point. The component |
I |
Matrix of |
Mauro Birattari and Gianluca Bontempi
library("lazy") data(cars) cars.lazy <- lazy(dist ~ speed, cars) predict(cars.lazy, data.frame(speed = seq(5, 30, 1)))
library("lazy") data(cars) cars.lazy <- lazy(dist ~ speed, cars) predict(cars.lazy, data.frame(speed = seq(5, 30, 1)))