Skip to content

Commit

Permalink
updated and debugged
Browse files Browse the repository at this point in the history
  • Loading branch information
parulvijay committed Jul 24, 2024
1 parent e864317 commit 7e803b9
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions GP_Solutions.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,7 @@ grid_datetime <- seq.Date(startdate, Sys.Date() + 365, by = 7) # create sequence
# You can pre process to have y transformed or have it in the loop.
rmse <- matrix(nrow = length(site_names), ncol = 1) # if rmse
for(i in 1:length(site_names)){
for(i in 1:7){
df_site <- subset(df, site_id == site_names[i])
# cutoff for sites
Expand All @@ -402,7 +402,7 @@ for(i in 1:length(site_names)){
X1c <- X1/ 53
X3c <- (X3 - min(X3))/ (max(X3)- min(X3))
X <- as.matrix(cbind.data.frame(X1c, X2, X3c))
y_obs <- df_train$observation # only at this location
y <- f(y_obs) # transform y
Expand All @@ -415,7 +415,7 @@ for(i in 1:length(site_names)){
XXt1c <- XXt1/53
XXt3 <- (XXt3 - min(XXt3))/ (max(XXt3)- min(XXt3))
XXt <- as.matrix(cbind.data.frame(XXt1c, XXt2, XXt3))
fit <- gpfit(X = X, y = y, XX = XXt)
# Make plots
Expand All @@ -437,7 +437,7 @@ for(i in 1:length(site_names)){
yt_true <- f(df_test$observation)
yt_pred <- f(fit$mean[which(grid_datetime %in% df_test$datetime)])
# calculate RMSE
rmse[i, ] <- sqrt(mean((yt_true - yt_pred)^2))
}
Expand Down

0 comments on commit 7e803b9

Please sign in to comment.