Skip to content

Commit

Permalink
old code rm
Browse files Browse the repository at this point in the history
  • Loading branch information
ivborissov committed Feb 4, 2025
1 parent 61dd607 commit 72739c2
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 109 deletions.
29 changes: 0 additions & 29 deletions test/optprob_fix.jl

This file was deleted.

19 changes: 0 additions & 19 deletions test/problems/jak-stat_model.jl
Original file line number Diff line number Diff line change
Expand Up @@ -117,22 +117,3 @@ function jakstat_obj_component(sim,data,σ)
end
return loss_i
end

#=
optf = OptimizationFunction(loss_func, Optimization.AutoForwardDiff())
#optf = OptimizationFunction(lsq_func, Optimization.AutoFiniteDiff())
_prob = OptimizationProblem(optf, p_best, lb=fill(-Inf,p_len), ub=fill(Inf,p_len))
maxiters = 1000
scan_bounds = (1e-4, 1e4)
Δθ = 0.2
identity_profiler = IntegrationProfiler(integrator=FBDF(autodiff=false), matrix_type=:identity, integrator_opts=(reltol=1e-3, abstol=1e-6, adaptive=false, dt=0.1), gamma = 100.)
hess_profiler = IntegrationProfiler(integrator=FBDF(autodiff=false), matrix_type=:hessian, integrator_opts=(reltol=1e-3, abstol=1e-6, adaptive=false, dt=0.1), gamma = 1.)
opt_profiler = OptimizationProfiler(NLopt.LN_NELDERMEAD, (reltol=1e-3,), :fixed, Δθ, maxiters)
@time opt_prof = profile_parameter(_prob, opt_profiler, 1; scan_bounds, verbose=true)
@time hess_prof = profile_parameter(_prob, hess_profiler, 1; scan_bounds, threashold=threshold, verbose=true)
@time identity_prof = profile_parameter(_prob, identity_profiler, 1; scan_bounds, threashold=threshold, verbose=true)
=#
60 changes: 0 additions & 60 deletions test/problems/taxol_model.jl
Original file line number Diff line number Diff line change
Expand Up @@ -121,63 +121,3 @@ end
# https://github.com/marisae/cancer-chemo-identifiability/blob/master/Profile%20Likelihood/testa0_fit.m#L40-L41
sigmasq = (mean([(Cerr005/C005); (Cerr010/C010); (Cerr040/C040); (Cerr100/C100)]))^2

#=
pid = 2
maxiters = 1000
scan_bounds = ((1 - 0.05*14)*p0[pid], (1 + 0.05*60)*p0[pid])
Δθ = 0.2
identity_profiler = IntegrationProfiler(integrator=Rodas4(autodiff=false), matrix_type=:identity, integrator_opts=(reltol=1e-3, abstol=1e-6), gamma = 1.)
hess_profiler = IntegrationProfiler(integrator=Rodas4(autodiff=false), matrix_type=:hessian, integrator_opts=(reltol=1e-3, abstol=1e-6), gamma = 1.)
opt_profiler0 = OptimizationProfiler(NLopt.LN_NELDERMEAD, (reltol=1e-3,), :fixed, Δθ, maxiters)
opt_profiler1 = OptimizationProfiler(NLopt.LN_NELDERMEAD, (reltol=1e-3,), :linear, Δθ, maxiters)
@time opt_prof0 = profile_parameter(_prob, opt_profiler0, pid; scan_bounds, threashold=threshold, verbose=true)
@time opt_prof1 = profile_parameter(_prob, opt_profiler1, pid; scan_bounds, threashold=threshold, verbose=true)
@time hess_prof = profile_parameter(_prob, hess_profiler, pid; scan_bounds, threashold=threshold, verbose=true)
@time identity_prof = profile_parameter(_prob, identity_profiler, pid; scan_bounds, threashold=threshold, verbose=true)
plot(identity_prof, dpi=400, legend=:top, xlabel="ka", ylabel="L(θ)")
plot!(hess_prof, alpha=0, conf_level=false, steps=false)
plot(opt_prof0, dpi=400, legend = :bottomleft, xlabel="ka", ylabel="L(θ)")
plot(opt_prof1, dpi=400, legend=:bottomleft, xlabel="ka", ylabel="L(θ)")
endp = LikelihoodProfiler.ProfileSolution(
nothing,
nothing,
hess_prof.θopt,
[[0., 4.92292246374492, 0., 0., 0.], [0., 10.778706398866387, 0., 0., 0.]],
[hess_prof.flevel, hess_prof.flevel],
2,
#syms::
hess_prof.flevel,
nothing,
nothing
)
df = CSV.read("./lp_ka.csv", DataFrame)
rename!(df, :f=>:obj)
ka_full = LikelihoodProfiler.ProfileSolution(
nothing,
nothing,
hess_prof.θopt,
[[df.ka[i]] for i in 1:64],
[df.obj[i] for i in 1:64],
1,
#syms::
hess_prof.flevel,
nothing,
nothing
)
plot(endp, xticks=[4, 6,7,8,9,10, 4.99, 10.73, 12], xlims=(4.5,11),
dpi=400, legend=:top, xlabel="ka", ylabel="L(θ)", endpoints=true)
scatter!((8.0959,0.538146855), label="optim")
plot!(ka_full, alpha=0.2, conf_level=false)
=#
2 changes: 1 addition & 1 deletion test/test_jak-stat_model.jl
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ end

# TODO Fix

@testset "JAK2-STAT5 model. Fixed-step OptimizationProfiler with derivative-free optimizer" begin
@testset "JAK2-STAT5 model. Fixed-step OptimizationProfiler with gradient-based optimizer" begin

idxs = 1:9
profile_step(p0, i) = abs(p0[i]) * 0.05
Expand Down

0 comments on commit 72739c2

Please sign in to comment.