Skip to content

Commit 03f53c5

Browse files
committed
Clean up docstring argument and return types
1 parent 9d1820e commit 03f53c5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+7127
-7084
lines changed

azure-pipelines.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ jobs:
7878
displayName: 'Build documentation'
7979

8080
- publish: 'build/sphinx/html'
81+
condition: 'succeededOrFailed()'
8182
artifact: 'Documentation'
8283
displayName: 'Publish documentation as artifact'
8384

doc/conf.py

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,18 @@
5252
bgcolor='"#ffffff"', center='true', style='solid')
5353
inheritance_node_attrs = dict(shape='ellipse', fontsize=12,
5454
fontname="monspace", height=0.75)
55+
5556
napoleon_use_param = False
57+
# TODO: enable type aliases
58+
# napoleon_preprocess_types = True # needed for type aliases to work
59+
# napoleon_type_aliases = {
60+
# "array_like": ":term:`array_like`",
61+
# "ndarray": "~numpy.ndarray",
62+
# "RandomState": ":class:`~numpy.random.RandomState`",
63+
# "DataFrame": ":class:`~pandas.DataFrame`",
64+
# "Series": ":class:`~pandas.Series`",
65+
# }
66+
5667
autosummary_generate = True
5768
autodoc_default_options = {'members': None,
5869
'show-inheritance': None,
@@ -76,7 +87,7 @@
7687
templates_path = ['_templates']
7788

7889
# The suffix(es) of source filenames.
79-
# You can specify multiple suffix as a list of string:
90+
# You can specify multiple suffix as a list of strings:
8091
#
8192
# source_suffix = ['.rst', '.md']
8293
source_suffix = '.rst'
@@ -215,11 +226,12 @@
215226

216227
# Example configuration for intersphinx: refer to the Python standard library.
217228
intersphinx_mapping = {'python': ('https://docs.python.org/3', None),
218-
'numpy': ('https://docs.scipy.org/doc/numpy/', None),
229+
'numpy': ('https://numpy.org/doc/stable/', None),
219230
'sklearn': ('https://scikit-learn.org/stable/', None),
220-
'matplotlib': ('https://matplotlib.org/', None),
231+
'matplotlib': ('https://matplotlib.org/stable/', None),
221232
'shap': ('https://shap.readthedocs.io/en/stable/', None),
222-
'dowhy': ('https://py-why.github.io/dowhy/v0.8/', None)}
233+
'dowhy': ('https://www.pywhy.org/dowhy/v0.8/', None),
234+
'statsmodels': ('https://www.statsmodels.org/stable/', None)}
223235

224236

225237
# -- Options for todo extension ----------------------------------------------

doc/spec/api.rst

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -97,10 +97,10 @@ The base class of all the methods in our API has the following signature:
9797
Parameters:
9898
Y: (n × d_y) matrix of outcomes for each sample
9999
T: (n × d_t) matrix of treatments for each sample
100-
X: optional (n × d_x) matrix of features for each sample
101-
W: optional (n × d_w) matrix of controls for each sample
102-
Z: optional (n × d_z) matrix of instruments for each sample
103-
inference: optional string, `Inference` instance, or None
100+
X: (n × d_x) matrix of features for each sample, optional
101+
W: (n × d_w) matrix of controls for each sample, optional
102+
Z: (n × d_z) matrix of instruments for each sample, optional
103+
inference: str or `Inference` instance, optional
104104
Method for performing inference. All estimators support 'bootstrap'
105105
(or an instance of `BootstrapInference`), some support other methods as well.
106106
'''
@@ -112,7 +112,7 @@ The base class of all the methods in our API has the following signature:
112112
Parameters:
113113
T0: (m × d_t) matrix of base treatments for each sample
114114
T1: (m × d_t) matrix of target treatments for each sample
115-
X: optional (m × d_x) matrix of features for each sample
115+
X: (m × d_x) matrix of features for each sample, optional
116116
117117
Returns:
118118
tau: (m × d_y) matrix of heterogeneous treatment effects on each outcome
@@ -125,7 +125,7 @@ The base class of all the methods in our API has the following signature:
125125
126126
Parameters:
127127
T: (m × d_t) matrix of base treatments for each sample
128-
X: optional (m × d_x) matrix of features for each sample
128+
X: (m × d_x) matrix of features for each sample, optional
129129
130130
Returns:
131131
grad_tau: (m × d_y × d_t) matrix of heterogeneous marginal effects on each outcome
@@ -137,10 +137,10 @@ The base class of all the methods in our API has the following signature:
137137
Available only when inference is not None, when calling the fit method.
138138
139139
Parameters:
140-
X: optional (m, d_x) matrix of features for each sample
141-
T0: optional (m, d_t) matrix of base treatments for each sample
142-
T1: optional (m, d_t) matrix of target treatments for each sample
143-
alpha: optional float in [0, 1] of the (1-alpha) level of confidence
140+
X: (m, d_x) matrix of features for each sample, optional
141+
T0: (m, d_t) matrix of base treatments for each sample, optional
142+
T1: (m, d_t) matrix of target treatments for each sample, optional
143+
alpha: float in [0, 1] of the (1-alpha) level of confidence, optional
144144
145145
Returns:
146146
lower, upper : tuple of the lower and the upper bounds of the confidence interval
@@ -153,8 +153,8 @@ The base class of all the methods in our API has the following signature:
153153
154154
Parameters:
155155
T: (m, d_t) matrix of base treatments for each sample
156-
X: optional (m, d_x) matrix of features for each sample
157-
alpha: optional float in [0, 1] of the (1-alpha) level of confidence
156+
X: (m, d_x) matrix of features for each sample, optional
157+
alpha: float in [0, 1] of the (1-alpha) level of confidence, optional
158158
159159
Returns:
160160
lower, upper : tuple of the lower and the upper bounds of the confidence interval
@@ -236,7 +236,7 @@ and constant marginal CATE interval at any target feature vector :math:`\vec{x}`
236236
features on a set of m test samples {X_i}
237237
238238
Parameters:
239-
X: optional (m × d_x) matrix of features for each sample
239+
X: (m × d_x) matrix of features for each sample, optional
240240
241241
Returns:
242242
theta: (m × d_y × d_f_t) matrix of constant marginal CATE of each treatment on each outcome
@@ -249,8 +249,8 @@ and constant marginal CATE interval at any target feature vector :math:`\vec{x}`
249249
Available only when inference is not None, when calling the fit method.
250250
251251
Parameters:
252-
X: optional (m, d_x) matrix of features for each sample
253-
alpha: optional float in [0, 1] of the (1-alpha) level of confidence
252+
X: (m, d_x) matrix of features for each sample, optional
253+
alpha: float in [0, 1] of the (1-alpha) level of confidence, optional
254254
255255
Returns:
256256
lower, upper : tuple of the lower and the upper bounds of the confidence interval

doc/spec/estimation/dml.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,7 @@ Usage FAQs
331331
potential approach one could take is simply run a big linear regression, regressing :math:`Y` on
332332
:math:`T, X, W` and then looking at the coefficient associated with the :math:`T` variable and
333333
the corresponding confidence interval (e.g. using statistical packages like
334-
:class:`~statsmodels.api.OLS`). However, this will not work if:
334+
:class:`~statsmodels.regression.linear_model.OLS`). However, this will not work if:
335335

336336
1) The number of control variables :math:`X, W` that you have is large and comparable
337337
to the number of samples. This could for instance arise if one wants to control for

0 commit comments

Comments
 (0)