Exposing rank deficient info
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Idoneità per principianti
- 25/100
- Tipo di issue
- Funzionalità
- Chiarezza
- Da chiarire
- Stato di attività
- Ferma
- Stack tecnologico
- julia
- Ambito
- api, backend-api-design
Direzione di ricerca
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.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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.
- Lingua principale
- Julia
- Stelle
- 19
- Fork
- 11
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Preparare l'ambiente
Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di JuliaStats/StatsAPI.jl
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 25/100
JuliaStats/StatsAPI.jl#25 · 1 reazione ·
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 25/100
JuliaStats/StatsAPI.jl#18 · 2 commenti ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 45/100
Tutte le issue di JuliaStats/StatsAPI.jl
Issue simili
-
enhancement good first issue help wanted
Difficoltà 2/5 Mezza giornata Idoneità per principianti 82/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
SciML/SciMLBase.jl#1643 ·
I maintainer di solito rispondono entro 2 giorni
-
authority-vechtstromen ready-for-agent
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 75/100
Deltares/Ribasim-NL#890 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 88/100
I maintainer di solito rispondono entro 1 giorno
-
Precompilation fails on Julia 1.14 nightly: HessenbergQ lmul! methods overwrite LinearAlgebra'sAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
JuliaLinearAlgebra/GenericLinearAlgebra.jl#183 · 1 commento ·