td_logistic.RdThis 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
)The age of events.
The event features.
The class labels. Y needs to be binary output.
The penalty coefficient. Default is 1.
If TRUE, each column of X is scaled to zero mean and standard deviation 1.
The number of time slots to use.
If TRUE, the squared attributes X^2 are included.
if TRUE, the most relevant interactions are included.
If TRUE logarithms of positive attributes will be computed.
A list with following components:
parThe parameters of the incomplete-event-classifier, after its fitted.
convergenceThe difference between the final two output values.
scaleIf scale=TRUE, contains the mean and the standard deviation of each column of X.
tThe age of events t is split into bins. This list element contains the boundary values of the bins.
quadThe value of quad in arguments.
interactThe value of interact in arguments.
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)