Skip to content

Commit

Permalink
before lecture 10
Browse files Browse the repository at this point in the history
  • Loading branch information
smkatz12 committed Feb 6, 2025
1 parent 9e0ebc9 commit 946a260
Show file tree
Hide file tree
Showing 2 changed files with 2,106 additions and 2 deletions.
11 changes: 9 additions & 2 deletions notebooks/failure_prob.jl
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,14 @@ end;

# ╔═╡ 7b37a30e-fec7-4854-a48e-b9eb036758e1
begin
pl1, _ = plot_samples(τs_is_fit, Normal(dist_fit.μ, dist_fit.σ), ws=ws_fit, color=thepurple, ymax=1.5, failure_dist=true)
# pl1, _ = plot_samples(τs_is_fit, Normal(dist_fit.μ, dist_fit.σ), ws=ws_fit, color=thepurple, ymax=1.5, failure_dist=true)
pl1 = plot(xlims=(-4, 4), ylims=(0, 1.5), grid=false, bg="transparent", background_color_inside=:black, fg="white", yticks=false, xticks=false, alpha=0.6, legend=false)
plot!(pl1, rectangle(abs(-4 - γ), 1.5, -4, 0), color=thered, alpha=0.3)
plot!(pl1, x->pdf(Truncated(Normal(), -Inf, γ), x), -4, 4, lw=1.5, color=:indianred1)
plot!(pl1, x->pdf(Normal(), x), -4, 4, color=:gray, lw=2)
plot!(pl1, x->pdf(Normal(dist_fit.μ, dist_fit.σ), x), -4, 4, color=thepurple, lw=2)
scatter!(pl1, 𝐬[5:end], 0.02 * ones(length(𝐬)-5), markercolor=thered, markerstrokecolor=:indianred1, ms=4, msw=2, alpha=0.25)

pll = plot(size=(650, 350))
plot_estimation_error!(pll, hists_mc, :white, ns=140, label="Direct Estimation")
plot_estimation_error!(pll, hists_is_fit, thepurple, ns=140, label="Fit Proposal")
Expand Down Expand Up @@ -593,7 +600,7 @@ begin
ysfail = [0.02 for s in 𝐬fail] #[pdf(dist, s) for s in 𝐬fail]
inds_fail = findall(𝐬 .< γ2)
# ws_fail = max.(min.(ws[inds_fail], 4), 0.1)
ws_fail = pdf.(Normal(), 𝐬fail) / pdf.(dist, 𝐬fail)
ws_fail = pdf.(Normal(), 𝐬fail) ./ pdf.(dist, 𝐬fail)
𝐬succ= filter(x->x>γ2, 𝐬)
yssucc = [0.02 for s in 𝐬succ] #[pdf(dist, s) for s in 𝐬succ]
inds_succ = findall(𝐬 .> γ2)
Expand Down
Loading

0 comments on commit 946a260

Please sign in to comment.