Skip to content

Commit

Permalink
Bugfix in l2loss_by_cv for unsupervised models
Browse files Browse the repository at this point in the history
  • Loading branch information
sylvaticus committed May 15, 2024
1 parent 55b7f69 commit 9ca2e6d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/Utils/Measures.jl
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,8 @@ function l2loss_by_cv(m,data;nsplits=5,nrepeats=1,rng=Random.GLOBAL_RNG)
(μ,σ) = cross_validation([x],sampler) do trainData,valData,rng
(xtrain,) = trainData; (xval,) = valData
fit!(m,xtrain)
x̂val = inverse_predict(m,xval)
x̂val_red = predict(m,xval)
x̂val = inverse_predict(m,x̂val_red)
ϵ = norm(xval .- x̂val)/size(xval,1)
reset!(m)
return ismissing(ϵ) ? Inf : ϵ
Expand Down

0 comments on commit 9ca2e6d

Please sign in to comment.