Skip to content

Commit 072eb98

Browse files
committed
Add asserts for cross_val_predict
1 parent 7526479 commit 072eb98

File tree

3 files changed

+9
-2
lines changed

3 files changed

+9
-2
lines changed

src/20_Optimisation/02_CrossValidation/06_Validation.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
function cross_val_predict(opt::NonFiniteAllocationOptimisationEstimator, rd::ReturnsResult,
22
cv::CrossValidationEstimator = KFold(); cols = :,
33
ex::FLoops.Transducers.Executor = FLoops.ThreadedEx())
4+
assert_internal_optimiser(opt)
5+
assert_external_optimiser(opt)
46
if !isa(cols, Colon)
57
rd = returns_result_view(rd, cols)
68
opt = opt_view(opt, cols, rd.X)

test/test_23_cross_validation.jl

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -569,7 +569,6 @@
569569
@test df_w[!, :nx] == dft_w[!, :nx]
570570
return nothing
571571
end
572-
573572
mr = MeanRisk(; opt = JuMPOptimiser(; slv = slv))
574573
cv = KFold(; n = 10)
575574
kfold_pred = cross_val_predict(mr, rd, cv)
@@ -617,5 +616,11 @@
617616
rng = StableRNG(666), seed = 69)
618617
multiple_rand_serial_pred = cross_val_predict(mr, rd, cv)
619618
test_pred(multiple_rand_serial_pred, "multiple_rand_serial_pred"; rtol = 1e-6)
619+
620+
mr = MeanRisk(;
621+
opt = JuMPOptimiser(; slv = slv,
622+
ret = ArithmeticReturn(; lb = Frontier(; N = 15))))
623+
cv = KFold(; n = 10)
624+
eff_front = cross_val_predict(mr, rd, cv)
620625
end
621626
end

test/test_24_docs.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,5 @@
1010
push!(no_docs, sym)
1111
end
1212
end
13-
@test length(no_docs) == 431
13+
@test length(no_docs) == 437
1414
end

0 commit comments

Comments
 (0)