| td_logistic | R Documentation |
This function does classification of incomplete events. The events grow with time. The input vector t denotes the age of the event. The classifier takes the growing event features, X and combines with a L2 penalty for smoothness.
td_logistic( t, X, Y, lambda = 1, scale = TRUE, num_bins = 4, quad = TRUE, interact = FALSE, logg = TRUE )
t |
The age of events. |
X |
The event features. |
Y |
The class labels. |
lambda |
The penalty coefficient. Default is 1. |
scale |
If |
num_bins |
The number of time slots to use. |
quad |
If |
interact |
if |
logg |
If |
A list with following components:
|
The parameters of the incomplete-event-classifier, after its fitted. |
|
The difference between the final two output values. |
|
If |
|
The age of events |
|
The value of |
|
The value of |
predict_tdl for prediction.
# Generate data
N <- 1000
t <- sort(rep(1:10, N))
set.seed(821)
for(kk in 1:10){
if(kk==1){
X <- seq(-11,9,length=N)
}else{
temp <- seq((-11-kk+1),(9-kk+1),length=N)
X <- c(X,temp)
}
}
real.a.0 <- seq(2,20, by=2)
real.a.1 <- rep(2,10)
Zstar <-real.a.0[t] + real.a.1[t]*X + rlogis(N, scale=0.5)
Z <- 1*(Zstar > 0)
# Plot data for t=1 and t=8
oldpar <- par(mfrow=c(1,2))
plot(X[t==1],Z[t==1], main="t=1 data")
abline(v=-1, lty=2)
plot(X[t==8],Z[t==8],main="t=8 data")
abline(v=-8, lty=2)
par(oldpar)
# Fit model
model_td <- td_logistic(t,X,Z)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.