Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhance the tbl property of a parametricbootstrap result #702

Merged
merged 19 commits into from
Aug 29, 2023
Merged

Conversation

dmbates
Copy link
Collaborator

@dmbates dmbates commented Aug 4, 2023

  • allow _generatesyms with string for tag
  • incorporate correlation estimates in table of parameter estimates from bootstrap

src/bootstrap.jl Outdated Show resolved Hide resolved
src/bootstrap.jl Outdated Show resolved Hide resolved
src/bootstrap.jl Outdated Show resolved Hide resolved
src/bootstrap.jl Outdated Show resolved Hide resolved
src/bootstrap.jl Outdated Show resolved Hide resolved
src/bootstrap.jl Outdated Show resolved Hide resolved
@JuliaStats JuliaStats deleted a comment from github-actions bot Aug 4, 2023
@codecov
Copy link

codecov bot commented Aug 4, 2023

Codecov Report

Patch coverage is 100.00% of modified lines.

Files Changed Coverage
src/bootstrap.jl 100.00%
src/profile/utilities.jl 100.00%

📢 Thoughts on this report? Let us know!.

@palday palday mentioned this pull request Aug 8, 2023
11 tasks
@github-actions
Copy link
Contributor

github-actions bot commented Aug 24, 2023

Benchmark Report for /home/runner/work/MixedModels.jl/MixedModels.jl

Job Properties

  • Time of benchmarks:
    • Target: 29 Aug 2023 - 19:44
    • Baseline: 29 Aug 2023 - 19:50
  • Package commits:
    • Target: 28f12f
    • Baseline: 6412fe
  • Julia commits:
    • Target: bed2cd
    • Baseline: bed2cd
  • Julia command flags:
    • Target: None
    • Baseline: -Cnative,-J/opt/hostedtoolcache/julia/1.9.3/x64/lib/julia/sys.so,-g1,-O3,-e,using Pkg; Pkg.update(); Pkg.add(["BenchmarkTools", "StatsModels"])
  • Environment variables:
    • Target: None
    • Baseline: None

Results

A ratio greater than 1.0 denotes a possible regression (marked with ❌), while a ratio less
than 1.0 denotes a possible improvement (marked with ✅). Only significant results - results
that indicate possible regressions or improvements - are shown below (thus, an empty table means that all
benchmark results remained invariant between builds).

ID time ratio memory ratio
["crossed", "insteval:1"] 0.54 (5%) ✅ 0.36 (1%) ✅
["crossed", "kb07:1"] 0.00 (5%) ✅ 0.00 (1%) ✅
["crossed", "ml1m:1"] 0.90 (5%) ✅ 0.77 (1%) ✅
["crossed", "mrk17_exp1:1"] 0.01 (5%) ✅ 0.18 (1%) ✅
["crossedvector", "d3:1"] 0.81 (5%) ✅ 0.51 (1%) ✅
["crossedvector", "mrk17_exp1:2"] 0.91 (5%) ✅ 0.65 (1%) ✅
["nested", "pastes:2"] 0.97 (5%) 0.98 (1%) ✅
["singlevector", "sleepstudy:3"] 0.00 (5%) ✅ 0.00 (1%) ✅

Benchmark Group List

Here's a list of all the benchmark groups executed by this job:

  • ["crossed"]
  • ["crossedvector"]
  • ["nested"]
  • ["singlevector"]

Julia versioninfo

Target

Julia Version 1.9.3
Commit bed2cd540a1 (2023-08-24 14:43 UTC)
Build Info:
  Official https://julialang.org/ release
Platform Info:
  OS: Linux (x86_64-linux-gnu)
      Ubuntu 22.04.3 LTS
  uname: Linux 5.15.0-1041-azure #48-Ubuntu SMP Tue Jun 20 20:34:08 UTC 2023 x86_64 x86_64
  CPU: Intel(R) Xeon(R) Platinum 8171M CPU @ 2.60GHz: 
              speed         user         nice          sys         idle          irq
       #1  2095 MHz       6425 s          0 s        233 s        486 s          0 s
       #2  2095 MHz       1435 s          0 s        291 s       5371 s          0 s
  Memory: 6.7694854736328125 GB (4858.171875 MB free)
  Uptime: 719.17 sec
  Load Avg:  1.0  1.07  0.76
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-14.0.6 (ORCJIT, skylake-avx512)
  Threads: 1 on 2 virtual cores

Baseline

Julia Version 1.9.3
Commit bed2cd540a1 (2023-08-24 14:43 UTC)
Build Info:
  Official https://julialang.org/ release
Platform Info:
  OS: Linux (x86_64-linux-gnu)
      Ubuntu 22.04.3 LTS
  uname: Linux 5.15.0-1041-azure #48-Ubuntu SMP Tue Jun 20 20:34:08 UTC 2023 x86_64 x86_64
  CPU: Intel(R) Xeon(R) Platinum 8171M CPU @ 2.60GHz: 
              speed         user         nice          sys         idle          irq
       #1  2095 MHz       8093 s          0 s        373 s       2635 s          0 s
       #2  2095 MHz       4751 s          0 s        415 s       5895 s          0 s
  Memory: 6.7694854736328125 GB (4904.3046875 MB free)
  Uptime: 1115.78 sec
  Load Avg:  1.1  1.35  1.04
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-14.0.6 (ORCJIT, skylake-avx512)
  Threads: 1 on 2 virtual cores

src/bootstrap.jl Outdated Show resolved Hide resolved
src/bootstrap.jl Outdated Show resolved Hide resolved
src/bootstrap.jl Outdated Show resolved Hide resolved
src/bootstrap.jl Outdated Show resolved Hide resolved
src/bootstrap.jl Outdated Show resolved Hide resolved
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@dmbates
Copy link
Collaborator Author

dmbates commented Aug 26, 2023

I believe the wonderful Benchmark comparisons are artificial. See Discussion #712

@dmbates dmbates requested a review from palday August 26, 2023 14:01
@dmbates
Copy link
Collaborator Author

dmbates commented Aug 26, 2023

@palday I think this is ready to go now. I can add to the documentation later. The general idea is to extract the tbl property of a bootstrap result. Plots of, e.g., empirical density estimates can be made using the wide approach in AlgebraOfGraphics. I will document that later.

@dmbates
Copy link
Collaborator Author

dmbates commented Aug 27, 2023

@palday I have updated the documentation but not yet switched the documentation to use AlgebraOfGraphics.jl. As an example of how to use AlgebraOfGraphics on the table of parametricbootstrap results

import CairoMakie
using AlgebraOfGraphics, MixedModels
using MixedModels: dataset

CairoMakie.activate!(; type="svg")
contrasts = Dict{Symbol, Any}(:subj => Grouping());

m01 = let f = @formula reaction ~ 1 + days + (1 + days|subj)
    fit(MixedModel, f, dataset(:sleepstudy); contrasts)
end

m01samp = parametricbootstrap(10_000, m01; hide_progress=true);
tbl = m01samp.tbl

draw(
    let σs = collect(filter(startswith('σ'), string.(propertynames(tbl))))
        data(tbl) *
        mapping(
            σs .=> "Bootstrap replicates of standard deviation parameters",
            color=dims(1) => renamer(σs),
        ) *
        density()
    end
)

Note that if we import CairoMakie instead of using then we do not need to qualify visualization functions like density.

Do you think we should create a function in MixedModelsMakie to encapsulate the operations in the draw call?

test/bootstrap.jl Outdated Show resolved Hide resolved
@palday
Copy link
Member

palday commented Aug 27, 2023

Do you think we should create a function in MixedModelsMakie to encapsulate the operations in the draw call?

Yes, though potentially AoG support should be in a package extension, in case somebody is using only the Makie and not AoG components.

We could also add support for plotting the sigmas to ridgeplot.

@dmbates dmbates changed the title Add method to utility. Add correlations to pbtbl. Enhance the tbl property of a parametricbootstrap result Aug 27, 2023
@dmbates
Copy link
Collaborator Author

dmbates commented Aug 28, 2023

Alternatively, and more simply, we could save a copy of lambda, create the table and copy the saved lambda back into the bootstrap struct.

I think this is the way to go.

Done.

docs/src/bootstrap.md Outdated Show resolved Hide resolved
src/bootstrap.jl Outdated Show resolved Hide resolved
src/bootstrap.jl Outdated Show resolved Hide resolved
src/bootstrap.jl Outdated Show resolved Hide resolved
src/bootstrap.jl Outdated Show resolved Hide resolved
Copy link
Member

@palday palday left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good -- I think this counts as a 'feature', so can you

  • bump the minor version number
  • add a NEWS entry

?

src/bootstrap.jl Outdated Show resolved Hide resolved
@dmbates
Copy link
Collaborator Author

dmbates commented Aug 29, 2023

@palday Would you take one more look and squash and merge if this seems okay to you?

palday and others added 2 commits August 29, 2023 19:31
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@palday palday merged commit d2a05aa into main Aug 29, 2023
10 checks passed
@palday palday deleted the db/extractpars branch August 29, 2023 20:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants