ajwheeler / ajwheeler/Korg.jl

Return the Jacobian from `ews_to_stellar_parameters`

Đang mở
#572 1 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
Julia
Star
67
Fork
15
Merge trung bình
2 ngày 6 giờ
Pull request đã merge (30 ngày)
6

Mô tả

By the time `ews_to_stellar_parameters` returns, it has the full Jacobian of the
four residual equations at the solution. It uses that once to make four error
bars and then drops it. I'd like it back.

The four classical conditions are strongly correlated, so four independent
error bars are a poor summary of what was actually fit. Everything needed for
the joint,

Σ_θ = J⁻¹ Σ_r J⁻ᵀ

is in scope at `fit_via_EWs.jl:424` and only `abs.(J \ σ_r)` comes out:

```julia
J = DiffResults.jacobian(J_result)[.!fix_params, .!fix_params]
param_uncertainties = zeros(4)
param_uncertainties[.!fix_params] .= abs.(J \ residual_uncertainties[.!fix_params])

params, param_uncertainties
```

`abs.()` on a linear solve throws away the sign structure that carries the
correlation, so it cannot be reconstructed from the four numbers afterwards.

We rebuild `J` ourselves by re-running ForwardDiff over
`_stellar_param_equation_residuals`, and the correlations are large:
ρ(Teff, [m/H]) = 0.87 on a solar HARPS EW table (169 Fe lines), 0.83 ± 0.09
across 56 FGK stars from the Gaia FGK Benchmark Stars library. Isochrone and SED
fitting routinely take the four parameters as independent, and at ρ ≈ 0.85 that
is a materially wrong likelihood.

What would help, in order of preference:

1. Return `J` and `residual_uncertainties` alongside the parameters — optional
named tuple field, or behind a keyword so the two-value return stays default.
2. Return `Σ_θ`. `fit_spectrum` already has a `covariance` field, so this would
make the two entry points consistent.
3. Document that the returned uncertainties are marginals of a correlated
posterior and should not be used as independent errors.

Recomputing `J` externally costs a full ForwardDiff pass over the exact
`ews_to_abundances` — 31% of our per-star wall time, duplicating a matrix Korg
has already built at that point.

I can PR (1). Smallest change, non-breaking.

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Hướng nghiên cứu

The relevant implementation is fit_via_EWs.jl:424; start by tracing how J and residual_uncertainties are available before the current abs.(J \ ...) calculation, then check callers of ews_to_stellar_parameters. Done means exposing the requested Jacobian and residual uncertainties without breaking the default two-value return, or documenting the correlated-uncertainty behavior if that option is chosen.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
julia
Lĩnh vực
backend-api-design, performance
Loại issue
Tính năng
Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức độ hoạt động
Sôi nổi
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
65/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.