Check my fitted dimension:str(predict(mod, Test1))
Named num [1:2131] 402 2346 1995 2205 2895 ... - attr(*, "names")= chr
[1:2131] "1" "2" "4" "6" ...
So i want to see AUC score for my model being applied into Test1data after
having splitting total data (Train) into Train 1 and Test 1, but i get the
following error:Error in roc.default(response, predictor, auc = TRUE, ...) :
No valid data provided.
Even trying this code also gives a
malfunction:error<-sqrt((sum((Test1$Item_Outlet_Sales-preds)^2))/nrow(Test1))
Error in Test1$Item_Outlet_Sales - preds : non-numeric argument to binary
operator===================================================
Here is the code:
set.seed(1234)
split <- sample(1:nrow(Train),size=floor((nrow(Train)/4)*3)) Train1 <-
Train[(split),]Test1 <-
Train[-split,]outcomeName='Item_Outlet_Sales'predictorNames <-
setdiff(names(Train1), outcomeName)mod <- lm(Item_Outlet_Sales ~ .,
data=Train1)preds <- predict(mod, Test1[,predictorNames], se.fit =
TRUE)print(auc(Test1[,outcomeName], preds$mod))
[[alternative HTML version deleted]]
______________________________________________
[email protected] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.