Category Archives for "Competitions"

Dec 12

Reusable Functions for Kaggle

By ganpati | Competitions

Here are some functions that will make your job easy while attempting multiple competitions.

Number of Unique Values in Each Column

all_name<- names(train)

for (i in 1:length(all_name)){
print(length(unique(train[,i])))
}

Correlation of Each Column with the Target Variable:

for (i in 4:length(all_name)){
if(is.numeric(train[,i]))
print( paste(cor(train[,3],train[,i]), “for col: “,i, sep=”” ))
}