Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
RAISS
Manage
Activity
Members
Labels
Plan
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Statistical-Genetics
RAISS
Commits
61f134aa
Commit
61f134aa
authored
5 years ago
by
Hanna JULIENNE
Browse files
Options
Downloads
Patches
Plain Diff
add adaptation of rcond to data if needed
parent
b65fe3b9
No related branches found
No related tags found
No related merge requests found
Pipeline
#18444
passed
5 years ago
Stage: test
Stage: deploy
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
raiss/stat_models.py
+10
-3
10 additions, 3 deletions
raiss/stat_models.py
with
10 additions
and
3 deletions
raiss/stat_models.py
+
10
−
3
View file @
61f134aa
...
@@ -68,6 +68,14 @@ def var_in_boundaries(var,lamb):
...
@@ -68,6 +68,14 @@ def var_in_boundaries(var,lamb):
return
var
return
var
def
invert_sig_t
(
sig_t
,
lamb
,
rcond
):
try
:
np
.
fill_diagonal
(
sig_t
.
values
,
(
1
+
lamb
))
sig_t_inv
=
scipy
.
linalg
.
pinv
(
sig_t
,
rcond
=
rcond
)
return
(
sig_t_inv
)
except
np
.
linalg
.
LinAlgError
:
invert_sig_t
(
sig_t
,
lamb
*
1.1
,
rcond
*
1.1
)
def
raiss_model
(
zt
,
sig_t
,
sig_i_t
,
lamb
=
0.01
,
rcond
=
0.01
,
batch
=
True
):
def
raiss_model
(
zt
,
sig_t
,
sig_i_t
,
lamb
=
0.01
,
rcond
=
0.01
,
batch
=
True
):
"""
"""
Compute the variance
Compute the variance
...
@@ -80,9 +88,8 @@ def raiss_model(zt, sig_t, sig_i_t, lamb=0.01, rcond=0.01, batch=True):
...
@@ -80,9 +88,8 @@ def raiss_model(zt, sig_t, sig_i_t, lamb=0.01, rcond=0.01, batch=True):
rcond (float): threshold to filter eigenvector with a eigenvalue under rcond
rcond (float): threshold to filter eigenvector with a eigenvalue under rcond
make inversion biased but much more numerically robust
make inversion biased but much more numerically robust
"""
"""
sig_t
=
sig_t
.
values
sig_t_inv
=
invert_sig_t
(
sig_t
,
lamb
,
rcond
)
np
.
fill_diagonal
(
sig_t
,
(
1
+
lamb
))
sig_t_inv
=
scipy
.
linalg
.
pinv
(
sig_t
,
rcond
=
rcond
)
if
batch
:
if
batch
:
condition_number
=
np
.
array
([
np
.
linalg
.
cond
(
sig_t
)]
*
sig_i_t
.
shape
[
0
])
condition_number
=
np
.
array
([
np
.
linalg
.
cond
(
sig_t
)]
*
sig_i_t
.
shape
[
0
])
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment