Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose standard_normal to RandomStream #530

Merged
merged 2 commits into from
Jul 22, 2021

Conversation

zoj613
Copy link
Member

@zoj613 zoj613 commented Jul 20, 2021

Exposes standard_normal to the random namespace for convenience and to be more consistent with the behavior of np.random.RandomState.

closes #528

twiecki
twiecki previously approved these changes Jul 20, 2021
@zoj613
Copy link
Member Author

zoj613 commented Jul 20, 2021

force-pushed to deal with the pre-commit fail. Not sure why it did not catch it since I ran it locally.

@zoj613
Copy link
Member Author

zoj613 commented Jul 20, 2021

Okay, for some reason the RandomStream class is still not picking up the new attribute at:

ns_obj = next(
(getattr(ns, obj) for ns in self.namespaces if hasattr(ns, obj)), None
)

EDIT: I see the issue now.

the partial function is not seen as an instance of RandomVariable. The test fails here:

from aesara.tensor.random.op import RandomVariable
if isinstance(ns_obj, RandomVariable):
@wraps(ns_obj)
def meta_obj(*args, **kwargs):
return self.gen(ns_obj, *args, **kwargs)
else:
raise AttributeError("No attribute {}.".format(obj))

twiecki
twiecki previously approved these changes Jul 21, 2021
@zoj613
Copy link
Member Author

zoj613 commented Jul 21, 2021

@twiecki lets try one more time. I fixed the test failure caused by the linter.

@codecov
Copy link

codecov bot commented Jul 21, 2021

Codecov Report

Merging #530 (d248e69) into main (57a1eb7) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##             main     #530   +/-   ##
=======================================
  Coverage   76.54%   76.55%           
=======================================
  Files         149      149           
  Lines       46726    46730    +4     
  Branches    10264    10264           
=======================================
+ Hits        35768    35772    +4     
  Misses       8350     8350           
  Partials     2608     2608           
Impacted Files Coverage Δ
aesara/tensor/random/basic.py 99.77% <100.00%> (+<0.01%) ⬆️

@twiecki twiecki merged commit 12ef382 into aesara-devs:main Jul 22, 2021
@twiecki
Copy link
Contributor

twiecki commented Jul 22, 2021

Thanks @zoj613!

@zoj613 zoj613 deleted the expose_std_normal branch July 22, 2021 15:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Expose standard_normal in RandomStream.
3 participants