Skip to content

Doc change the default value of pymc.draw from 500 to 1. #5543

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

Merged
merged 3 commits into from
Mar 6, 2022

Conversation

purna135
Copy link
Member

@purna135 purna135 commented Mar 4, 2022

Closes #5542

Changed the default value of draws from 500 to 1.

@codecov
Copy link

codecov bot commented Mar 4, 2022

Codecov Report

Merging #5543 (9c6b5de) into main (4223b6e) will increase coverage by 0.02%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #5543      +/-   ##
==========================================
+ Coverage   87.24%   87.26%   +0.02%     
==========================================
  Files          81       81              
  Lines       14244    14244              
==========================================
+ Hits        12427    12430       +3     
+ Misses       1817     1814       -3     
Impacted Files Coverage Δ
pymc/sampling.py 87.24% <ø> (ø)
pymc/parallel_sampling.py 87.70% <0.00%> (+0.99%) ⬆️

@OriolAbril
Copy link
Member

do you want to update the rest of the docstring following #5459? Both yes or no are fine, they just influence the scope of the review

@purna135
Copy link
Member Author

purna135 commented Mar 5, 2022

Yes @OriolAbril, I'm happy to update the remainder of the docstring, but I'm not sure how to set the proper type for vars, what is default for mode as it's a optional.
Could you kindly guide me how to find the default value of a variable?
I will work on all the methords present in website following #5459.

Copy link
Member

@OriolAbril OriolAbril left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pymc/sampling.py Outdated
@@ -2128,7 +2128,7 @@ def draw(
vars
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
vars
vars : tensor_like or iterable of tensor_like

vars is missing the type but it is required, so it should have no optional nor default after the type.

pymc/sampling.py Outdated
@@ -2128,7 +2128,7 @@ def draw(
vars
A variable or a list of variables for which to draw samples.
draws : int
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
draws : int
draws : int, default 1

draws is optional, so it should have either optional or default. As here the default is of the documented type and a specific value, using default instead of optional is preferred, as explained in the third point of https://pymc-data-umbrella.xyz/en/latest/sprint/docstring_tutorial.html#parameters. The default would then be removed from the description below

pymc/sampling.py Outdated
@@ -2128,7 +2128,7 @@ def draw(
vars
A variable or a list of variables for which to draw samples.
draws : int
Number of samples needed to draw. Detaults to 500.
Number of samples needed to draw. Detaults to 1.
mode
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is missing the type and the , optional

pymc/sampling.py Outdated
@@ -2128,7 +2128,7 @@ def draw(
vars
A variable or a list of variables for which to draw samples.
draws : int
Number of samples needed to draw. Detaults to 500.
Number of samples needed to draw. Detaults to 1.
mode
The mode used by ``aesara.function`` to compile the graph.
**kwargs
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
**kwargs
**kwargs : dict, optional

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, I will follow the same : )

pymc/sampling.py Outdated
Comment on lines 2137 to 2140
Returns
-------
List[np.ndarray]
out : list of ndarrays
A list of numpy arrays.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if this return statement is correct; please have a look.

pymc/sampling.py Outdated
@@ -2125,18 +2125,18 @@ def draw(

Parameters
----------
vars
vars : tensor_like or iterable of tensor_like
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I made a mistake here before, tensor_like includes things that can be converted to aesara tensorvariable like lists or numpy arrays, that is not the case here.

Suggested change
vars : tensor_like or iterable of tensor_like
vars : Variable or iterable of Variable

pymc/sampling.py Outdated
**kwargs
draws : int, default 1
Number of samples needed to draw.
mode : str or `Mode` instance, optional
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there should be no backticks in type descriptions. I am not sure if Mode is a common input type, if it is, this should be Mode without backticks nor instance and we'll add a numpydoc alias. If it is not, it should be aesara.compile.mode.Mode again no backticks nor instance.

pymc/sampling.py Outdated
Keyword arguments for :func:`pymc.aesara.compile_pymc`

Returns
-------
List[np.ndarray]
out : list of ndarrays
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
out : list of ndarrays
list of ndarray

types should always be used in singular version, and in numpydoc, if there is only one output it should not be named, only the type info should be present.

pymc/sampling.py Outdated
draws : int, default 1
Number of samples needed to draw.
mode : str or `Mode` instance, optional
The mode used by :func:``aesara.function`` to compile the graph.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
The mode used by :func:``aesara.function`` to compile the graph.
The mode used by :func:`aesara.function` to compile the graph.

@purna135
Copy link
Member Author

purna135 commented Mar 5, 2022

Thank you very much, @OriolAbril; I'm learning a lot from you 😊😃

@OriolAbril OriolAbril merged commit 620546b into pymc-devs:main Mar 6, 2022
@purna135 purna135 deleted the doc_samplers_draw branch March 12, 2022 10:07
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.

Doc change the default value of pymc.draw from 500 to 1.
3 participants