Skip to content

Commit 64f2b98

Browse files
docstring cosmetics
1 parent 20eb1ca commit 64f2b98

File tree

1 file changed

+32
-18
lines changed

1 file changed

+32
-18
lines changed

src/glum/_glm.py

+32-18
Original file line numberDiff line numberDiff line change
@@ -232,12 +232,12 @@ def _parse_formula(
232232
formula: FormulaSpec, include_intercept: bool = True
233233
) -> tuple[Optional[Formula], Formula]:
234234
"""
235-
Parse and transform the formula for use in a GeneralizedLinearRegressor.
235+
Parse and transform the formula for use in a GeneralizedLinearRegressor.
236236
237237
The left-hand side and right-hand side of the formula are separated. If an
238-
intercept is present, it is removed from the right-hand side, and a boolean
239-
flag is returned to indicate whether or not an intercept should be added to
240-
the model.
238+
intercept is present, it wil be removed from the right-hand side, and a
239+
boolean flag to indicate whether or not an intercept should be added to
240+
the model will be returned.
241241
242242
Parameters
243243
----------
@@ -1315,7 +1315,7 @@ def linear_predictor(
13151315
context : Optional[Union[int, Mapping[str, Any]]], default=0
13161316
The context to use for evaluating the formula. If an integer, the
13171317
context is taken from the stack frame of the caller at the given
1318-
depth. If a dict, it is used as the context directly.
1318+
depth. If a dict, it is directly used as the context.
13191319
13201320
Returns
13211321
-------
@@ -1406,7 +1406,7 @@ def predict(
14061406
context : Optional[Union[int, Mapping[str, Any]]], default=0
14071407
The context to use for evaluating the formula. If an integer, the
14081408
context is taken from the stack frame of the caller at the given
1409-
depth. If a dict, it is used as the context directly.
1409+
depth. If a dict, it is directly used as the context.
14101410
14111411
Returns
14121412
-------
@@ -1480,7 +1480,7 @@ def coef_table(
14801480
context : Optional[Union[int, Mapping[str, Any]]], default=0
14811481
The context to use for evaluating the formula. If an integer, the
14821482
context is taken from the stack frame of the caller at the given
1483-
depth. If a dict, it is used as the context directly.
1483+
depth. If a dict, it is directly used as the context.
14841484
14851485
Returns
14861486
-------
@@ -1563,7 +1563,7 @@ def wald_test(
15631563
15641564
The right hand side of the tested hypothesis is specified by ``r``. In the
15651565
case of a ``terms``-based test, the null hypothesis is that each coefficient
1566-
relating to a term is equal to the corresponding value in ``r``.
1566+
relating to a term equals the corresponding value in ``r``.
15671567
15681568
Parameters
15691569
----------
@@ -1578,7 +1578,7 @@ def wald_test(
15781578
of the expressions separated by ``+`` signs. Otherwise, a term is one column
15791579
in the input data. As categorical variables need not be one-hot encoded in
15801580
glum, in their case, the hypothesis to be tested is that the coefficients
1581-
for all of their levels are equal to ``r``.
1581+
of all categories are equal to ``r``.
15821582
r : np.ndarray, optional, default=None
15831583
The vector representing the values of the linear combination.
15841584
If None, the test is for whether the linear combinations of the coefficients
@@ -1610,7 +1610,7 @@ def wald_test(
16101610
context : Optional[Union[int, Mapping[str, Any]]], default=0
16111611
The context to use for evaluating the formula. If an integer, the
16121612
context is taken from the stack frame of the caller at the given
1613-
depth. If a dict, it is used as the context directly.
1613+
depth. If a dict, it is directly used as the context.
16141614
16151615
Returns
16161616
-------
@@ -2019,7 +2019,7 @@ def _wald_test_term_names(
20192019
of the expressions separated by ``+`` signs. Otherwise, a term is one column
20202020
in the input data. As categorical variables need not be one-hot encoded in
20212021
glum, in their case, the hypothesis to be tested is that the coefficients
2022-
for all of their levels are equal to ``r``.
2022+
of all categories are equal to ``r``.
20232023
values: Sequence, optional, default=None
20242024
The values to which coefficients are compared. If None, the test is
20252025
for whether the coefficients are zero.
@@ -2157,7 +2157,8 @@ def std_errors(
21572157
context : Optional[Union[int, Mapping[str, Any]]], default=0
21582158
The context to use for evaluating the formula. If an integer, the
21592159
context is taken from the stack frame of the caller at the given
2160-
depth. If a dict, it is used as the context directly."""
2160+
depth. If a dict, it is directly used as the context.
2161+
"""
21612162
captured_context = capture_context(
21622163
context + 1 if isinstance(context, int) else context
21632164
)
@@ -2200,36 +2201,48 @@ def covariance_matrix(
22002201
X : {array-like, sparse matrix}, shape (n_samples, n_features), optional
22012202
Training data. Can be omitted if a covariance matrix has already
22022203
been computed.
2204+
22032205
y : array-like, shape (n_samples,), optional
22042206
Target values. Can be omitted if a covariance matrix has already
22052207
been computed.
2208+
22062209
mu : array-like, optional, default=None
22072210
Array with predictions. Estimated if absent.
22082211
offset : array-like, optional, default=None
22092212
Array with additive offsets.
2213+
22102214
sample_weight : array-like, shape (n_samples,), optional, default=None
22112215
Individual weights for each sample.
2216+
22122217
dispersion : float, optional, default=None
22132218
The dispersion parameter. Estimated if absent.
2219+
22142220
robust : boolean, optional, default=None
2221+
22152222
Whether to compute robust standard errors instead of normal ones.
22162223
If not specified, the model's ``robust`` attribute is used.
22172224
clusters : array-like, optional, default=None
2225+
22182226
Array with cluster membership. Clustered standard errors are
22192227
computed if clusters is not None.
2228+
22202229
expected_information : boolean, optional, default=None
22212230
Whether to use the expected or observed information matrix.
22222231
Only relevant when computing robust standard errors.
2232+
22232233
If not specified, the model's ``expected_information`` attribute is used.
22242234
store_covariance_matrix : boolean, optional, default=False
22252235
Whether to store the covariance matrix in the model instance.
22262236
If a covariance matrix has already been stored, it will be overwritten.
2237+
22272238
skip_checks : boolean, optional, default=False
22282239
Whether to skip input validation. For internal use only.
2240+
22292241
context : Optional[Union[int, Mapping[str, Any]]], default=0
22302242
The context to use for evaluating the formula. If an integer, the
22312243
context is taken from the stack frame of the caller at the given
2232-
depth. If a dict, it is used as the context directly.
2244+
depth. If a dict, it is directly used as the context.
2245+
22332246
Notes
22342247
-----
22352248
We support three types of covariance matrices:
@@ -2493,7 +2506,7 @@ def score(
24932506
context : Optional[Union[int, Mapping[str, Any]]], default=0
24942507
The context to use for evaluating the formula. If an integer, the
24952508
context is taken from the stack frame of the caller at the given
2496-
depth. If a dict, it is used as the context directly.
2509+
depth. If a dict, it is directly used as the context.
24972510
24982511
Returns
24992512
-------
@@ -3389,7 +3402,7 @@ def fit(
33893402
context : Optional[Union[int, Mapping[str, Any]]], default=0
33903403
The context to use for evaluating the formula. If an integer, the
33913404
context is taken from the stack frame of the caller at the given
3392-
depth. If a dict, it is used as the context directly.
3405+
depth. If a dict, it is directly used as the context.
33933406
33943407
weights_sum: float, optional (default=None)
33953408
@@ -3708,7 +3721,7 @@ def aic(
37083721
context : Optional[Union[int, Mapping[str, Any]]], default=0
37093722
The context to use for evaluating the formula. If an integer, the
37103723
context is taken from the stack frame of the caller at the given
3711-
depth. If a dict, it is used as the context directly.
3724+
depth. If a dict, it is directly used as the context.
37123725
"""
37133726
captured_context = capture_context(
37143727
context + 1 if isinstance(context, int) else context
@@ -3748,7 +3761,7 @@ def aicc(
37483761
context : Optional[Union[int, Mapping[str, Any]]], default=0
37493762
The context to use for evaluating the formula. If an integer, the
37503763
context is taken from the stack frame of the caller at the given
3751-
depth. If a dict, it is used as the context directly.
3764+
depth. If a dict, it is directly used as the context.
37523765
"""
37533766
captured_context = capture_context(
37543767
context + 1 if isinstance(context, int) else context
@@ -3792,7 +3805,8 @@ def bic(
37923805
context : Optional[Union[int, Mapping[str, Any]]], default=0
37933806
The context to use for evaluating the formula. If an integer, the
37943807
context is taken from the stack frame of the caller at the given
3795-
depth. If a dict, it is used as the context directly."""
3808+
depth. If a dict, it is directly used as the context.
3809+
"""
37963810
captured_context = capture_context(
37973811
context + 1 if isinstance(context, int) else context
37983812
)

0 commit comments

Comments
 (0)