Skip to content

Conversation

palday
Copy link
Member

@palday palday commented Aug 21, 2025

  • add entry in NEWS.md

closes #618

@palday palday marked this pull request as ready for review August 21, 2025 05:44
palday and others added 9 commits August 21, 2025 05:45
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@palday palday requested a review from dmbates August 21, 2025 06:31
Copy link

codecov bot commented Aug 21, 2025

Codecov Report

❌ Patch coverage is 97.14286% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 95.51%. Comparing base (bf4b8eb) to head (1034335).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
src/generalizedlinearmixedmodel.jl 50.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #850      +/-   ##
==========================================
+ Coverage   95.49%   95.51%   +0.01%     
==========================================
  Files          38       38              
  Lines        3708     3720      +12     
==========================================
+ Hits         3541     3553      +12     
  Misses        167      167              
Flag Coverage Δ
current 95.18% <97.14%> (+0.01%) ⬆️
minimum 95.51% <97.14%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@dmbates
Copy link
Collaborator

dmbates commented Aug 21, 2025

@palday I had an alternative approach using a "matrix table" for the result, as defined in Tables.jl. Because the objective is Float64 and the theta value is Vector{Float64} (or T and Vector{T} where {T}, if you prefer) we can push! the objective and merge! the theta value onto the end of a Vector{T}. At convergence we apply Tables.table to the transpose of a reshape of this vector into a matrix of size (ntheta + 1, neval). We need to have names for the columns (after transposing) and I generated them from the parmap, as in par_1_1_1. Is it okay with you if I make such a change? We can back it out later if it doesn't seem to be working.

@palday
Copy link
Member Author

palday commented Aug 21, 2025

@dmbates please go ahead!

Copy link
Collaborator

@dmbates dmbates left a comment

Choose a reason for hiding this comment

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

As I said in the review of #853 I think my plan of creating a MatrixTable for the fitlog led to too many changes so I think that this PR and #853 should both be merged. Afterwards I will add an extractor function to create a table with scalar columns from the current tabular form, in case that is desired.

@palday
Copy link
Member Author

palday commented Aug 22, 2025

Afterwards I will add an extractor function to create a table with scalar columns from the current tabular form, in case that is desired.

@dmbates don't forget that we have a Tables.columntable method that does something similar:

"""
columntable(s::OptSummary, [stack::Bool=false])
Return `s.fitlog` as a `Tables.columntable`.
When `stack` is false (the default), there will be 3 columns in the result:
- `iter`: the iteration number
- `objective`: the value of the objective at that sample
- `θ`: the parameter vector at that sample
When `stack` is true, there will be 4 columns: `iter`, `objective`, `par`, and `value`
where `value` is the stacked contents of the `θ` vectors (the equivalent of `vcat(θ...)`)
and `par` is a vector of parameter numbers.
"""
function Tables.columntable(s::OptSummary; stack::Bool=false)
fitlog = s.fitlog
val = (; iter=axes(fitlog, 1), objective=last.(fitlog), θ=first.(fitlog))
stack || return val
θ1 = first(val.θ)
k = length(θ1)
return (;
iter=repeat(val.iter; inner=k),
objective=repeat(val.objective; inner=k),
par=repeat(1:k; outer=length(fitlog)),
value=foldl(vcat, val.θ; init=(eltype(θ1))[]),
)
end

@palday palday merged commit d7f9223 into main Aug 22, 2025
11 of 12 checks passed
@palday palday deleted the pa/fitlog-forever branch August 22, 2025 17:04
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.

Simplify fitlog logic
2 participants