1 #' @include b_Algorithm.R
3 #' @title Generalized Additive Model
5 #' @description Generalized Additive Model using the \code{gam} package.
6 #' Inherits \code{\link{Algorithm}}
8 #' @field family Family of the distribution to be used. Default: gaussian().
10 GeneralizedAdditive = setRefClass(
11 Class = "GeneralizedAdditive",
14 "family" #class "family"
17 contains = "Algorithm",
20 initialize = function(...)
23 if (class(family) == "uninitializedField")
26 predict_noNA = function(XY, x)
28 #GAM need some data to provide reliable results
31 X = XY[,names(XY) != "Measure"]
33 weight = ridgeSolve(X, Y, LAMBDA)
34 return (matricize(x) %*% weight)
37 suppressPackageStartupMessages( require(gam) )
38 g = gam(Measure ~ ., data=XY, family=family)
39 return (stats::predict(g, x))