Revision 0808cccd065a352f040da3e14e8fbd4f2ec2427c authored by pat-s on 11 December 2019, 14:08:00 UTC, committed by pat-s on 11 December 2019, 14:08:00 UTC
1 parent c2f2bf6
RLearner_regr_fgam.R
#' @export
makeRLearner.regr.fgam = function() {
makeRLearnerRegr(
cl = "regr.fgam",
package = "refund",
par.set = fgam.ps,
par.vals = fgam.par.vals,
properties = c("functionals", "single.functional"),
name = "functional general additive model",
short.name = "FGAM"
)
}
#' @export
trainLearner.regr.fgam = function(.learner, .task, .subset, .weights = NULL, ...) {
requirePackages("refund")
parlist = list(...)
m = getTaskData(.task, functionals.as = "matrix")
tn = getTaskTargetNames(.task)
fns = getTaskFeatureNames(.task)
formmat = getFGAMFormulaMat(mdata = m, targetname = tn, fns = fns, parlist = parlist)
pfr = refund::pfr
pfr(formula = formmat$form, data = formmat$mat.list, family = gaussian())
}
#' @export
predictLearner.regr.fgam = function(.learner, .model, .newdata, ...) {
assert(hasFunctionalFeatures(.newdata))
nl = as.list(.newdata)
as.vector(predict(.model$learner.model, newdata = nl, type = "response"))
}
![swh spinner](/static/img/swh-spinner.gif)
Computing file changes ...