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
Sebastian Bruijns
sab_pybasicbayes
Commits
1b578620
Commit
1b578620
authored
7 years ago
by
Scott Linderman
Browse files
Options
Downloads
Patches
Plain Diff
working around weird bug with broadcasting over strided arrays
parent
f9406df0
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
pybasicbayes/distributions/regression.py
+7
-5
7 additions, 5 deletions
pybasicbayes/distributions/regression.py
with
7 additions
and
5 deletions
pybasicbayes/distributions/regression.py
+
7
−
5
View file @
1b578620
...
...
@@ -985,8 +985,8 @@ class RobustRegression(Regression):
n
,
D
=
y
.
shape
scaled_x
=
x
*
precisions
[:,
None
]
scaled_y
=
y
*
precisions
[:,
None
]
scaled_x
=
x
*
precisions
[:,
na
]
scaled_y
=
y
*
precisions
[:,
na
]
xxT
=
scaled_x
.
T
.
dot
(
x
)
yxT
=
scaled_y
.
T
.
dot
(
x
)
yyT
=
scaled_y
.
T
.
dot
(
y
)
...
...
@@ -1006,7 +1006,9 @@ class RobustRegression(Regression):
precisions
=
precisions
[
~
bad
]
n
,
D
=
data
.
shape
[
0
],
self
.
D_out
scaled_data
=
data
*
precisions
[:
None
]
# This tile call is suboptimal but without it we can hit issues
# with strided data, as in autoregressive models.
scaled_data
=
data
*
np
.
tile
(
precisions
[:,
None
],
(
1
,
data
.
shape
[
1
]))
statmat
=
scaled_data
.
T
.
dot
(
data
)
xxT
,
yxT
,
yyT
=
\
...
...
@@ -1044,7 +1046,7 @@ class RobustRegression(Regression):
x
,
y
=
data
else
:
x
,
y
=
data
[:,
:
self
.
D_
in
],
data
[:,
self
.
D_
in
:]
x
,
y
=
data
[:,
:
-
self
.
D_
out
],
data
[:,
-
self
.
D_
out
:]
assert
x
.
ndim
==
y
.
ndim
==
2
assert
x
.
shape
[
0
]
==
y
.
shape
[
0
]
...
...
@@ -1111,7 +1113,7 @@ class _ARMixin(object):
return
self
.
D_out
def
predict
(
self
,
x
):
return
super
(
_ARMixin
,
self
).
predict
(
np
.
atleast_2d
(
x
.
ravel
()
))
return
super
(
_ARMixin
,
self
).
predict
(
np
.
atleast_2d
(
x
))
def
rvs
(
self
,
lagged_data
):
return
super
(
_ARMixin
,
self
).
rvs
(
...
...
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