0

I have a database with the variables: recodedTime_second, OperatorStepLevel, Operator and StepType. There are 11 operators and 16 stepTypes (tasks). The recoded time is the amount of seconds a worker take to do a task each time he is recorded.

I want to do a decision tree that only takes one worker and one step type per time. Also, a confusion to know the accuracy.

I create a database of the worker 10446 doing the steptype AE. I have run:

X10446AE<-transform(X10446AE,Operator=as.character(Operator),StepType=as.character(StepType), OperatorStepLevel=as.integer(OperatorStepLevel),recodedTime_second=as.integer(recodedTime_second),P1P_DateTime=as.POSIXct(P1P_DateTime))

set.seed(100)
tr=sample(1:nrow(X10446AE), round(nrow(X10446AE)*0.7)) 
train= X10446AE [tr,] 
test=X10446AE [-tr,]
arbol_10446AE <- rpart(formula = OperatorStepLevel ~recodedTime_second, data = train)
arbol_10446AE
rpart.plot(arbol_10446AE)

I can not do the prediction and the confusion matrix

Rui Barradas
  • 70,273
  • 8
  • 34
  • 66
  • Have you tried `predict(arbol_10446AE)`? – Rui Barradas May 10 '22 at 17:58
  • 1
    Hi! What do you mean by not being able to do the prediction and confusion matrix? Are you getting error messages? The output is not what you expected? – Juan Bosco May 10 '22 at 18:10
  • 1
    It looks like you're new to SO; welcome to the community! If you want great answers quickly, it's best to make your question reproducible. This includes sample data like the output from `dput(head(dataObject)))`, any libraries you are using, and any errors/warnings received. Check it out: [making R reproducible questions](https://stackoverflow.com/q/5963269). If your data is proprietary, consider including similar data in your post that is free of private or protected content. – Kat May 10 '22 at 21:52

0 Answers0