Exposing rank deficient info
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức phù hợp với người mới
- 25/100
- Loại issue
- Tính năng
- Độ rõ ràng
- Cần làm rõ
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- julia
- Lĩnh vực
- api, backend-api-design
Hướng nghiên cứu
Start by reading the issue's StatsAPI and GLM examples, then inspect the RegressionModel, LinPredModel, DensePredChol, and eventual DensePredQR entry points mentioned there. Determine whether the API should expose independent and collinear model-matrix column indexes, and confirm the design with the unanswered discussion before attempting an implementation.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
I want to discuss the best way to have an API for RegressionModels that are rank deficient. In particular, I would like to have a mechanism allowing packages interfacing through StatsAPI to recover the collinear columns of the model matrix.
Consider this example (I am going to use GLM.jl):
X1 = randn(100)
X2 = randn(100)
y = X1 + X2 + randn(100)
df = DataFrame(y=y,X1=X1,X2=X2, X3=X1, X4=X1.+X2)
lm_1 = lm(@formula(y~X1+X2+X3+X4), df)
Using the StatsAPI, there is no way to recover the three columns of the model matrix that are linearly independent. However, one can do this by looking at the DensePredChol (and eventually at the DensePredQR).
For instance, if I want to calculate X'X using only these columns, I could do
X = modelmatrix(lm_1)
XX = X'X
ch = lm_1.model.pp.chol
rnk = rank(ch)
XX[1:end .∉ [ch.p[rnk+1:end]], 1:end .∉ [ch[rnk+1:end]]]
and similarly, for the columns of the modelmatrix:
Z = X[:, 1:end .∉ [ch.p[rnk+1:end]]]
I don't know the best way to expose this at the API level. Maybe something like this?
function StatsAPI.collinearindexes(r::RegressionModel) end
The implementation in GLM could then look something like this:
function GLM.collinearindexes(m::LinPredModel) ## of course only for `CholeskyPivoted` (and `QRPivoted` when implemented)
ch = m.pp.chol
rnk = rank(ch)
return ch.p[1:rnk], ch.p[rnk+1:end]
end
Probably not great. Ideas?
P.S.: This is very useful to make packages like CovarianceMatrices play nice with rank-deficient RegressionModels.
- Ngôn ngữ chính
- Julia
- Star
- 19
- Fork
- 11
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Chuẩn bị môi trường
Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của JuliaStats/StatsAPI.jl
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 25/100
JuliaStats/StatsAPI.jl#25 · 1 reaction ·
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 25/100
JuliaStats/StatsAPI.jl#18 · 2 bình luận ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 45/100
Tất cả issue của JuliaStats/StatsAPI.jl
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
JuliaGPU/KernelAbstractions.jl#897 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
oscar-system/GAP.jl#1455 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
JuliaAI/MLJTransforms.jl#85 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
SciML/OrdinaryDiffEq.jl#4875 ·
Maintainer thường phản hồi trong vòng 4 ngày