Last active
February 22, 2022 09:04
-
-
Save MJacobs1985/f5b2b8146496fccdd46c1bec5c4bec9d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
training_comp<-training%>%na.omit() | |
enetgrid<-expand.grid(.lambda=c(0,0.01,.1), | |
.fraction = seq(0.5, 1 , length=20)) | |
enet1 <- train(rochefant~.-customer, data = training_comp, | |
preProcess = c("center", "scale"), | |
method = "enet", | |
tuneGrid=enetgrid, | |
trControl = tr) | |
enet1;summary(enet1);plot(enet1) | |
enet1pred<-predict(enet1, testing) | |
pm1values<-data.frame(obs=testing$rochefant, | |
pred=enet1pred, | |
wts=testing$weightclasshalv, | |
cfactor=testing$c.factor, | |
length=testing$length) | |
ggplot(pm1values, aes(obs,pred, | |
colour=length, | |
size=cfactor)) + | |
geom_point(alpha=0.3,size=2) + | |
geom_smooth(method=lm, se=FALSE,colour="red", linetype="dashed")+ | |
geom_abline(slope=1, linetype="dashed") + theme_bw() + | |
facet_wrap(~wts) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment