X-Git-Url: https://git.auder.net/assets/current/gitweb.js?a=blobdiff_plain;f=pkg%2FR%2Fm_MLPoly.R;fp=pkg%2FR%2Fm_MLPoly.R;h=0000000000000000000000000000000000000000;hb=57dbbab63a48b42f85e0a711640e1dd10b58f18a;hp=a19a2c997408f16ddcbbdf35f6d7d967fbbdc22b;hpb=357b8be00388d07c04c10d4bf7f503fd947185d2;p=aggexp.git diff --git a/pkg/R/m_MLPoly.R b/pkg/R/m_MLPoly.R deleted file mode 100644 index a19a2c9..0000000 --- a/pkg/R/m_MLPoly.R +++ /dev/null @@ -1,51 +0,0 @@ -#' @include b_LinearAlgorithm.R - -#' @title MLpoly Algorithm -#' -#' @description MLpoly Algorithm. -#' Inherits \code{\link{LinearAlgorithm}} -#' -#' @field alpha Importance of weights redistribution, in [0,1]. Default: 0 -#' @field grad Whether to use or not the (sub)gradient trick. Default: FALSE -#' -MLpoly = setRefClass( - Class = "MLpoly", - - fields = c( - alpha = "numeric", - grad = "logical" - ), - - contains = "LinearAlgorithm", - - methods = list( - initialize = function(...) - { - callSuper(...) - if (length(alpha) == 0 || alpha < 0. || alpha > 1.) - alpha <<- 0. #no redistribution - if (length(grad) == 0) - grad <<- FALSE - }, - predict_noNA = function(XY, x) - { - K = ncol(XY) - 1 - if (K == 1) - { - #shortcut: nothing to combine - finalWeight = 1. - } - - else - { - X = XY[,names(XY) != "Measure"] - Y = XY[,"Measure"] - finalWeight = .C("ml_predict_noNA", X = as.double(t(X)), Y = as.double(Y), n = as.integer(nrow(XY)), - K = as.integer(K), alpha=as.double(alpha), grad = as.integer(grad), weight=double(K))$weight - } - - appendWeight(finalWeight) - return (matricize(x) %*% finalWeight) - } - ) -)