Quantcast
Channel: Data Science, Analytics and Big Data discussions - Latest topics
Viewing all articles
Browse latest Browse all 4448

Error in apply(submit_match3[, -1], 1, Mode) : dim(X) must have a positive length

$
0
0

@harry wrote:

I am currently trying to solve one classification problem for improving my model performance I have created three xgboost model .Then I have created a data frame which include the id and output of all three model.I am trying to find the maximum frequency of output from the three output for this I have used apply function on to it.But I am getting the error.

Mode <- function(x) {
u <- unique(x)
u[which.max(tabulate(match(x, u)))]
}

y <- apply(submit_match3[,-1],1,Mode) # removing the id column
data.table(y)

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 4448

Trending Articles