Skip to content

Commit

Permalink
Update plot functions
Browse files Browse the repository at this point in the history
  • Loading branch information
KauriGiant committed Feb 23, 2025
1 parent 73fe4e9 commit 5400214
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
5 changes: 2 additions & 3 deletions xgb.cv.fit.scatterplot.r
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
##################################################
###Simple boxplot of predicted probabilities for
###continuous responses.
###Simple scatter plot of observed and predicted responses
###Designed for easy inspection of xgb.cv predictions
##################################################
xgbm.cv.fit.scatterplot = function(pred,CVtrain_y,path)
Expand All @@ -9,7 +8,7 @@ xgbm.cv.fit.scatterplot = function(pred,CVtrain_y,path)
Title = paste0("Cor = ",Cor)
Filename = paste0(path,"FitScatterplot.png")
png(Filename, height = 1600,width = 1600)
par(mar = c(10,12,12,2), cex.main = 4,cex.lab = 3.6,cex.axis = 3.4,mgp = c(7,3.5,0))
par(mar = c(10,12,12,2), cex.main = 5,cex.lab = 4.8,cex.axis = 4.6,mgp = c(7,2,0))
plot(pred~CVtrain_y, main = Title,
xlab = paste0("Observed response"),ylab = paste0("Fitted response"), pch = NA)
points(CVtrain_y,pred, cex = 2, col = 1)
Expand Down
6 changes: 3 additions & 3 deletions xgb.cv.partial.r
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,9 @@ xgbm.cv.partial = function(cv,Nfolds,CVtrain_x,var,path,CVtrain_y,ResponseName =
Title = Predictors[var]
Filename = paste0(path,ResponseName,".",Predictors[var],".partial.png")
png(Filename,width = 1800, height = 1600)
par(mfcol = c(1,1), cex.main = 4, cex.lab = 3, cex.axis = 3, mar = c(10,8,8,2),
mgp = c(4,1,0),font.lab = 2,oma = c(0, 0, 9, 0))
plot(PartialPreds[,1],PartialPreds[,2], ylim = c(min(CVtrain_y),max(CVtrain_y)),pch = NA,
par(mfcol = c(1,1), cex.main = 5, cex.lab = 4.8, cex.axis = 4.6, mar = c(10,12,8,2),
mgp = c(7,2,0),font.lab = 2,oma = c(0, 0, 9, 0))
plot(PartialPreds[,1],PartialPreds[,2], ylim = c(min(PartialPreds[,2]),max(PartialPreds[,2])),pch = NA,
xlab = Predictors[var], ylab = ResponseName,main = Title)
for(fold in 1:Nfolds)
lines(PartialPreds[PartialPreds$Fold == fold,1],PartialPreds[PartialPreds$Fold == fold,2],lty=3,col = fold,lwd = 3)
Expand Down

0 comments on commit 5400214

Please sign in to comment.