| samEL | R Documentation |
Fit a sparse additive Poisson regression model on training data.
samEL(
X,
y,
p = 3,
lambda = NULL,
nlambda = NULL,
lambda.min.ratio = 0.25,
thol = 1e-05,
max.ite = 1e+05,
regfunc = "L1"
)
X |
Numeric training matrix with |
y |
Response vector of length |
p |
The number of basis spline functions. The default value is 3. |
lambda |
Optional user-supplied regularization sequence. If provided, use a decreasing sequence; warm starts are used along the path and are usually much faster than fitting a single value. |
nlambda |
The number of lambda values. The default value is 20. |
lambda.min.ratio |
Smallest lambda as a fraction of |
thol |
Stopping tolerance. The default value is |
max.ite |
Maximum number of iterations. The default value is |
regfunc |
A string indicating the regularizer. The default value is "L1". You can also assign "MCP" or "SCAD" to it. |
The solver combines block coordinate descent, fast iterative soft-thresholding, and Newton updates. Computation is accelerated by warm starts and active-set screening.
p |
The number of basis spline functions used in training. |
X.min |
Per-feature minimums from training data (used to rescale test data). |
X.ran |
Per-feature ranges from training data (used to rescale test data). |
lambda |
Sequence of regularization parameters used in training. |
w |
Solution path matrix with size |
df |
Degrees of freedom along the solution path (number of non-zero component functions). |
knots |
The |
Boundary.knots |
The |
func_norm |
Functional norm matrix ( |
SAM,plot.samEL,print.samEL,predict.samEL
## generating training data
n = 200
d = 100
X = 0.5*matrix(runif(n*d),n,d) + matrix(rep(0.5*runif(n),d),n,d)
u = exp(-2*sin(X[,1]) + X[,2]^2-1/3 + X[,3]-1/2 + exp(-X[,4])+exp(-1)-1+1)
y = rep(0,n)
for(i in 1:n) y[i] = rpois(1,u[i])
## Training
out.trn = samEL(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)
ut = exp(-2*sin(Xt[,1]) + Xt[,2]^2-1/3 + Xt[,3]-1/2 + exp(-Xt[,4])+exp(-1)-1+1)
yt = rep(0,nt)
for(i in 1:nt) yt[i] = rpois(1,ut[i])
## predicting response
out.tst = predict(out.trn,Xt)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.