@@ -72,20 +72,20 @@ o2cv<-function(X, Y, nc, nx, ny, group=NULL, nr_folds = 5, ncores=1,
7272 res <- do.call(" c" ,res )
7373 results <- as.data.frame(t(sapply(res , function (x )unlist(x ))))
7474 results <- results %> %group_by(nc ,nx ,ny )%> %
75- summarise(Qx = mean( Qx ), Qy = mean( Qy ), Px = mean(Px ),Py = mean(Py ),Rx = mean(Rx ),Ry = mean(Ry ))%> %
76- mutate(RMSE = Rx + Ry , Qxy = sqrt( Qx ^ 2 + Qy ^ 2 )) %> %arrange(desc( Qxy ) )
75+ summarise(Px = mean(Px ),Py = mean(Py ),Rx = mean(Rx ),Ry = mean(Ry ))%> %
76+ mutate(RMSE = Rx + Ry ) %> %arrange(RMSE )
7777
7878 # ## results <- results%>%filter(Qx>=0,Qy>=0)
7979 # ## not sure if meaningful
8080 nc <- as.data.frame(results )[1 ,1 ]
8181 nx <- as.data.frame(results )[1 ,2 ]
8282 ny <- as.data.frame(results )[1 ,3 ]
83- Qxy <- as.data.frame(results )[1 ,11 ]
84- RMSE <- as.data.frame(results )[1 ,10 ]
83+ # Qxy <- as.data.frame(results)[1,11]
84+ RMSE <- as.data.frame(results )[1 ,8 ]
8585 message(" #####################################" )
8686 message(" The best parameters are nc = " ,nc ," , nx = " ,nx ," , ny = " ,ny )
8787 message(" #####################################" )
88- message(" The Qxy is " , Qxy , " and the RMSE is: " , RMSE )
88+ message(" The the RMSE is: " , RMSE )
8989 message(" #####################################" )
9090 return (results )
9191}
@@ -163,9 +163,11 @@ o2cv<-function(X, Y, nc, nx, ny, group=NULL, nr_folds = 5, ncores=1,
163163 # Restore to original values
164164 Xev <- X [cls.grp == k & is.na(cls.grp )== FALSE ,]
165165 Yev <- Y [cls.grp == k & is.na(cls.grp )== FALSE ,]
166-
167- tmp <- list (k = k , nc = n , nx = nx , ny = ny , Qx = abs(Q(Xev ,X_hat )),
168- Qy = abs(Q(Yev ,Y_hat )),Px = s2(Xev - X_hat ),Py = s2(Yev - Y_hat ),
166+ # ####
167+ # ### just use the RMSE to determine the best paramaters
168+ # ## some thing shown wrong results with Q values
169+ tmp <- list (k = k , nc = n , nx = nx , ny = ny ,
170+ Px = s2(Xev - X_hat ),Py = s2(Yev - Y_hat ),
169171 Rx = rcpp_rmse(Xev ,X_hat ),Ry = rcpp_rmse(Yev ,Y_hat ))
170172 results <- append(results , list (tmp ))
171173 }
0 commit comments