Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
sab_pybasicbayes
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
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
AGPD_Public
sab_pybasicbayes
Commits
7cfb91ad
Commit
7cfb91ad
authored
1 year ago
by
SebastianBruijns
Browse files
Options
Downloads
Patches
Plain Diff
testing code
parent
209ddc46
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
pybasicbayes/testing/dynglm_optimisation_test.py
+49
-0
49 additions, 0 deletions
pybasicbayes/testing/dynglm_optimisation_test.py
pybasicbayes/testing/test_data
+0
-0
0 additions, 0 deletions
pybasicbayes/testing/test_data
pybasicbayes/testing/truth
+0
-0
0 additions, 0 deletions
pybasicbayes/testing/truth
with
49 additions
and
0 deletions
pybasicbayes/testing/dynglm_optimisation_test.py
0 → 100644
+
49
−
0
View file @
7cfb91ad
"""
Need to find out whether loglikelihood is computed correctly.
Or whether a bug here allows states to invade each other more easily.
We
'
ll test this by comparing to pymc results.
"""
import
numpy
as
np
from
dynamic_glm
import
Dynamic_GLM
import
pickle
import
matplotlib.pyplot
as
plt
# Testing of Dynamic_GLM implementation
np
.
set_printoptions
(
suppress
=
True
)
seed
=
np
.
random
.
randint
(
10000
)
# 215
print
(
seed
)
seed
=
5489
np
.
random
.
seed
(
seed
)
T
=
16
n_inputs
=
3
step_size
=
0.2
Q
=
np
.
tile
(
np
.
eye
(
n_inputs
),
(
T
,
1
,
1
))
test
=
Dynamic_GLM
(
n_inputs
=
n_inputs
,
T
=
T
,
P_0
=
4
*
np
.
eye
(
n_inputs
),
Q
=
Q
*
step_size
,
prior_mean
=
np
.
zeros
(
n_inputs
))
w
=
np
.
zeros
(
n_inputs
)
test_points
=
[
0
]
predictors
=
[]
a
,
b
=
np
.
zeros
(
1000
),
np
.
zeros
(
1000
)
a
[
250
:
500
]
=
1
a
[
750
:
1000
]
=
1
b
[
500
:]
=
1
for
_
in
range
(
T
):
if
_
in
[
0
,
1
,
8
,
9
,
10
,
11
,
12
,
14
,
15
]:
predictors
.
append
(
np
.
empty
((
0
,
n_inputs
)))
continue
t
=
1000
pred
=
np
.
empty
((
t
,
n_inputs
))
pred
[:,
0
]
=
a
pred
[:,
1
]
=
b
pred
[:,
2
]
=
1
predictors
.
append
(
pred
)
sample
=
test
.
rvs
(
predictors
,
list
(
range
(
T
)))
pickle
.
dump
(
sample
,
open
(
'
test_data
'
,
'
wb
'
))
pickle
.
dump
(
test
,
open
(
'
truth
'
,
'
wb
'
))
plt
.
plot
(
test
.
weights
)
plt
.
show
()
This diff is collapsed.
Click to expand it.
pybasicbayes/testing/test_data
0 → 100644
+
0
−
0
View file @
7cfb91ad
File added
This diff is collapsed.
Click to expand it.
pybasicbayes/testing/truth
0 → 100644
+
0
−
0
View file @
7cfb91ad
File added
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