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
)

Arguments

t

The age of events.

X

The event features.

Y

The class labels. Y needs to be binary output.

lambda

The penalty coefficient. Default is 1.

scale

If TRUE, each column of X is scaled to zero mean and standard deviation 1.

num_bins

The number of time slots to use.

quad

If TRUE, the squared attributes X^2 are included.

interact

if TRUE, the most relevant interactions are included.

logg

If TRUE logarithms of positive attributes will be computed.

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 scale=TRUE, contains the mean and the standard deviation of each column of X.

t

The age of events t is split into bins. This list element contains the boundary values of the bins.

quad

The value of quad in arguments.

interact

The value of interact in arguments.

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)