td_logistic {eventstream} | R Documentation |
Classification with incomplete-event-classifier
Description
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.
Usage
td_logistic(
t,
X,
Y,
lambda = 1,
scale = TRUE,
num_bins = 4,
quad = TRUE,
interact = FALSE,
logg = TRUE
)
Arguments
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 |
Value
A list with following components:
par |
The parameters of the incomplete-event-classifier, after its fitted. |
convergence |
The difference between the final two output values. |
scale |
If |
t |
The age of events |
quad |
The value of |
interact |
The value of |
See Also
predict_tdl
for prediction.
Examples
# 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)