@@ -92,8 +92,6 @@ sm3 = SampleModel("arsenic_logistic_t", model_str; tmpdir=tmpdir);
9292cvitr, cvitst = cvit (n, 10 , true )
9393kfcvs = similar (loos)
9494for cvi in 1 : 10
95- @printf (" %d\n " , cvi)
96-
9795 standatacv = (p = m, N = length (cvitr[cvi]), Nt = length (cvitst[cvi]),
9896 x = x[cvitr[cvi],:], y = Int .(y[cvitr[cvi]]),
9997 xt = x[cvitst[cvi],:], yt = Int .(y[cvitst[cvi]]))
@@ -104,14 +102,14 @@ for cvi in 1:10
104102 nt3 = read_samples (sm3)
105103 # Compute LOO and standard error
106104 log_likt = nt3. log_likt'
107- n_sam, n_obs = size (log_lik )
108- kfcvs[cvitst[cvi]] =
105+ local n_sam, n_obs = size (log_likt )
106+ kfcvs[cvitst[cvi]] . =
109107 reshape (logsumexp (log_likt .- log (n_sam); dims= 1 ), n_obs)
110108 end
111109end
112110
113111# compare PSIS-LOO and k-fold-CV
114112plot ([- 3.5 , 0 ], [- 3.5 , 0 ], color= :red )
115- scatter! (loos[ 1 ,:], kfcvs[ 1 ,:] , xlab = " PSIS-LOO" , ylab = " 10-fold-CV" ,
113+ scatter! (loos1, kfcvs, xlab = " PSIS-LOO" , ylab = " 10-fold-CV" ,
116114 leg= false , color= :darkblue )
117115savefig (joinpath (ProjDir, " compare.png" ))
0 commit comments