Exposing rank deficient info
Personne n'a encore pris cette issue.
Évaluation
- Difficulté
- 5/5
- Temps estimé
- Plus d'une semaine
- Accessibilité débutants
- 25/100
- Type d'issue
- Fonctionnalité
- Clarté
- À clarifier
- Activité
- À l'abandon
- Stack technique
- julia
- Domaine
- api, backend-api-design
Piste de recherche
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.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
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.
- Langage dominant
- Julia
- Étoiles
- 19
- Forks
- 11
- Métriques de merge des PR
- Aucune PR mergée en 30 j
Préparer son environnement
Ce projet ne fournit ni conteneur de développement, ni Dockerfile, ni guide de contribution : l'installation est à votre charge. Commencez par son README, et consultez notre guide de la première contribution pour les étapes générales.
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de JuliaStats/StatsAPI.jl
-
Difficulté 5/5 Plus d'une semaine Accessibilité débutants 25/100
JuliaStats/StatsAPI.jl#25 · 1 réaction ·
-
Difficulté 5/5 Plus d'une semaine Accessibilité débutants 25/100
JuliaStats/StatsAPI.jl#18 · 2 commentaires ·
-
Difficulté 2/5 1-3 heures Accessibilité débutants 45/100
Toutes les issues de JuliaStats/StatsAPI.jl
Issues similaires
-
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100
JuliaGPU/KernelAbstractions.jl#897 ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100
oscar-system/GAP.jl#1455 ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 65/100
JuliaAI/MLJTransforms.jl#85 ·
-
Difficulté 2/5 1-3 heures Accessibilité débutants 70/100
SciML/OrdinaryDiffEq.jl#4875 ·
Les mainteneurs répondent en général sous 4 jours