samQL {SAM} | R Documentation |
Training function of Sparse Additive Models
Description
The regression model is learned using training data.
Usage
samQL(
X,
y,
p = 3,
lambda = NULL,
nlambda = NULL,
lambda.min.ratio = 0.005,
thol = 1e-05,
max.ite = 1e+05,
regfunc = "L1"
)
Arguments
X |
The |
y |
The |
p |
The number of basis spline functions. The default value is 3. |
lambda |
A user supplied lambda sequence. Typical usage is to have the program compute its own lambda sequence based on nlambda and lambda.min.ratio. Supplying a value of lambda overrides this. WARNING: use with care. Do not supply a single value for lambda. Supply instead a decreasing sequence of lambda values. samQL relies on its warms starts for speed, and its often faster to fit a whole path than compute a single fit. |
nlambda |
The number of lambda values. The default value is 30. |
lambda.min.ratio |
Smallest value for lambda, as a fraction of lambda.max, the (data derived) entry value (i.e. the smallest value for which all coefficients are zero). The default is 5e-3. |
thol |
Stopping precision. The default value is 1e-5. |
max.ite |
The number of maximum iterations. The default value is 1e5. |
regfunc |
A string indicating the regularizer. The default value is "L1". You can also assign "MCP" or "SCAD" to it. |
Details
We adopt various computational algorithms including the block coordinate descent, fast iterative soft-thresholding algorithm, and newton method. The computation is further accelerated by "warm-start" and "active-set" tricks.
Value
p |
The number of basis spline functions used in training. |
X.min |
A vector with each entry corresponding to the minimum of each input variable. (Used for rescaling in testing) |
X.ran |
A vector with each entry corresponding to the range of each input variable. (Used for rescaling in testing) |
lambda |
A sequence of regularization parameter used in training. |
w |
The solution path matrix ( |
intercept |
The solution path of the intercept. |
df |
The degree of freedom of the solution path (The number of non-zero component function) |
knots |
The |
Boundary.knots |
The |
func_norm |
The functional norm matrix ( |
sse |
Sums of square errors of the solution path. |
See Also
SAM
,plot.samQL,print.samQL,predict.samQL
Examples
## generating training data
n = 100
d = 500
X = 0.5*matrix(runif(n*d),n,d) + matrix(rep(0.5*runif(n),d),n,d)
## generating response
y = -2*sin(X[,1]) + X[,2]^2-1/3 + X[,3]-1/2 + exp(-X[,4])+exp(-1)-1
## Training
out.trn = samQL(X,y)
out.trn
## plotting solution path
plot(out.trn)
## generating testing data
nt = 1000
Xt = 0.5*matrix(runif(nt*d),nt,d) + matrix(rep(0.5*runif(nt),d),nt,d)
yt = -2*sin(Xt[,1]) + Xt[,2]^2-1/3 + Xt[,3]-1/2 + exp(-Xt[,4])+exp(-1)-1
## predicting response
out.tst = predict(out.trn,Xt)