Description Usage Arguments Examples
This function implement a first-order solution for the GLM maximum likelihood problem using only gradient information with adaptive momentum gradient descent algorithm
1 | gdMomentum_GLM(X, y, mu_fun, lambda, maxit = 10000, tol = 1e-05, gamma = 0.8)
|
X |
The design matrix |
y |
The response variable |
mu_fun |
The function of eta, which is the matrix multiplication of design matrix with vector beta |
lambda |
The stepsize in gradient descent updata |
maxit |
Integer maximum number of iterations |
tol |
Numeric tolerance parameter |
gamma |
The momentum term which indicates how much acceleration you want |
1 2 3 4 5 6 | pd <- tibble(offers=c(rep(0,50),rep(1,30),rep(2,10),rep(3,7),rep(4,3)),
division=sample(c("A","B","C"),100,replace = TRUE),
exam=c(runif(50,60,80),runif(30,65,95),runif(20,75,95)))
y<- matrix(pd$offers,ncol = 1)
X<- model.matrix(offers~division+exam,data=pd)
gdMomentum_GLM(X,y,mu_fun=function(eta) exp(eta),lambda = 1e-3)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.