"Error in the table (pred = prediction, true = W [, 8]): all arguments must be the same length"

this is my data:

  Anon_Student_Id Problem_Hierarchy Problem_Name Problem_View Number_Of_Steps Sum_Of_Steps_Duration Sum_Of_Hints result
 1 80nlN05JQ6 Unit ES_01, Section ES_01-6 EG21 8 3 28 0 1
 2 80nlN05JQ6 Unit ES_01, Section ES_01-6 EG21 9 3 37 0 0
 3 80nlN05JQ6 Unit ES_01, Section ES_01-6 EG21 10 3 50 0 0
 4 80nlN05JQ6 Unit ES_01, Section ES_01-6 EG22 1 3 78 0 0
 5 80nlN05JQ6 Unit ES_01, Section ES_01-6 EG22 2 3 41 0 1
 6 80nlN05JQ6 Unit ES_01, Section ES_01-6 EG22 3 3 92 0 0

I am trying to predict the result attribute from the SVM model:

model <-svm (result ~., scale = FALSE, data = W)

prediction <- forecasting (model, W [, - 8])

table (pred = prediction, true = W [, 8])

But I get this error:

"Error in table(pred = prediction, true = W[, 8]) : all arguments must have the same length" 

When I checked it, I got: length (pred) = 2042 and length (true) = 2043

Why am I getting this error? (I mean, why do I get different lengths? Pre and Truth should be the same length)

Thanks!

+4
source share
1 answer

The problem is resolved: I got rid of all the na values โ€‹โ€‹of my data using na.omit (W) and then worked. thanks!

+3
source

Source: https://habr.com/ru/post/1486690/


All Articles