-
Notifications
You must be signed in to change notification settings - Fork 31
Changing variable broadcasting for factors #133
Conversation
…and changed all the corresponding test cases.
Codecov Report
@@ Coverage Diff @@
## develop #133 +/- ##
===========================================
- Coverage 85.25% 85.11% -0.14%
===========================================
Files 77 77
Lines 4163 3817 -346
Branches 731 653 -78
===========================================
- Hits 3549 3249 -300
+ Misses 411 375 -36
+ Partials 203 193 -10
Continue to review full report at Codecov.
|
|
||
|
||
def broadcast_samples_dict(F, array_dict, num_samples=None): | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Docstring?
@@ -155,7 +89,19 @@ def log_cdf(self, F=None, **kwargs): | |||
""" | |||
raise NotImplementedError | |||
|
|||
def draw_samples(self, rv_shape, num_samples=1, F=None, **kwargs): | |||
def draw_samples(self, F, variables, num_samples=1, targets=None, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Docstring? As above with the variable replacement comment?
replicant.broadcastable = self.broadcastable | ||
return replicant | ||
|
||
def eval(self, F, variables, always_return_tuple=False): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Docstring? Explaining what this function does with samples in particular thanks.
|
||
|
||
def broadcast_to(data, shape): | ||
"""The broadcast_to operator""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you expand this operator's docstring a bit?
Maybe even include a small example/typical usage like in the docs:
m.x.set_prior(Gaussian(mean=broadcast_to(array([0]), m.x.shape),
variance=broadcast_to(array([1]), m.x.shape)))
Co-Authored-By: zhenwendai <zhenwendai@users.noreply.github.com>
Description of changes:
Implemented the according to the Design Proposal 1.
The changes include:
broadcast_to
operator to allow users to explicitly broadcast variables.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.