Skip to content

Commit 1edf68e

Browse files
docs(backport): Correct fixed_params type to tuple or list (#2428)
* Backport PR #2420 * `fixed_params` is an iterable that is of type tuple or list. Though operations on it may support tensor types, not all operations will necessarily be supported and so the docs should not list it as being a tensor.
1 parent 6bf1f4a commit 1edf68e

File tree

5 files changed

+23
-23
lines changed

5 files changed

+23
-23
lines changed

src/pyhf/infer/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,8 @@ def hypotest(
6161
par_bounds (:obj:`tensor`): The extrema of values the model parameters
6262
are allowed to reach in the fit.
6363
The shape should be ``(n, 2)`` for ``n`` model parameters.
64-
fixed_params (:obj:`tensor` of :obj:`bool`): The flag to set a parameter constant to its starting
65-
value during minimization.
64+
fixed_params (:obj:`tuple` or :obj:`list` of :obj:`bool`): The flag to set a parameter
65+
constant to its starting value during minimization.
6666
calctype (:obj:`str`): The calculator to create. Choose either 'asymptotics' (default) or 'toybased'.
6767
return_tail_probs (:obj:`bool`): Bool for returning :math:`\mathrm{CL}_{s+b}` and :math:`\mathrm{CL}_{b}`
6868
return_expected (:obj:`bool`): Bool for returning :math:`\mathrm{CL}_{\mathrm{exp}}`

src/pyhf/infer/calculators.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,8 @@ def generate_asimov_data(
6161
par_bounds (:obj:`tensor`): The extrema of values the model parameters
6262
are allowed to reach in the fit.
6363
The shape should be ``(n, 2)`` for ``n`` model parameters.
64-
fixed_params (:obj:`tensor` of :obj:`bool`): The flag to set a parameter constant to its starting
65-
value during minimization.
64+
fixed_params (:obj:`tuple` or :obj:`list` of :obj:`bool`): The flag to set a parameter
65+
constant to its starting value during minimization.
6666
return_fitted_pars (:obj:`bool`): Return the best-fit parameter values for the given ``asimov_mu``.
6767
6868
@@ -241,8 +241,8 @@ def __init__(
241241
par_bounds (:obj:`tensor`): The extrema of values the model parameters
242242
are allowed to reach in the fit.
243243
The shape should be ``(n, 2)`` for ``n`` model parameters.
244-
fixed_params (:obj:`tensor` of :obj:`bool`): The flag to set a parameter constant to its starting
245-
value during minimization.
244+
fixed_params (:obj:`tuple` or :obj:`list` of :obj:`bool`): The flag to set a parameter
245+
constant to its starting value during minimization.
246246
test_stat (:obj:`str`): The test statistic to use as a numerical summary of the
247247
data: ``'qtilde'``, ``'q'``, or ``'q0'``.
248248
@@ -685,8 +685,8 @@ def __init__(
685685
par_bounds (:obj:`tensor`): The extrema of values the model parameters
686686
are allowed to reach in the fit.
687687
The shape should be ``(n, 2)`` for ``n`` model parameters.
688-
fixed_params (:obj:`tensor` of :obj:`bool`): The flag to set a parameter constant to its starting
689-
value during minimization.
688+
fixed_params (:obj:`tuple` or :obj:`list` of :obj:`bool`): The flag to set a parameter
689+
constant to its starting value during minimization.
690690
test_stat (:obj:`str`): The test statistic to use as a numerical summary of the
691691
data: ``'qtilde'``, ``'q'``, or ``'q0'``.
692692

src/pyhf/infer/mle.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,8 @@ def fit(data, pdf, init_pars=None, par_bounds=None, fixed_params=None, **kwargs)
106106
par_bounds (:obj:`list` of :obj:`list`/:obj:`tuple`): The extrema of values the model parameters
107107
are allowed to reach in the fit.
108108
The shape should be ``(n, 2)`` for ``n`` model parameters.
109-
fixed_params (:obj:`list` of :obj:`bool`): The flag to set a parameter constant to its starting
110-
value during minimization.
109+
fixed_params (:obj:`tuple` or :obj:`list` of :obj:`bool`): The flag to set a parameter
110+
constant to its starting value during minimization.
111111
kwargs: Keyword arguments passed through to the optimizer API
112112
113113
Returns:
@@ -180,8 +180,8 @@ def fixed_poi_fit(
180180
par_bounds (:obj:`list` of :obj:`list`/:obj:`tuple`): The extrema of values the model parameters
181181
are allowed to reach in the fit.
182182
The shape should be ``(n, 2)`` for ``n`` model parameters.
183-
fixed_params (:obj:`list` of :obj:`bool`): The flag to set a parameter constant to its starting
184-
value during minimization.
183+
fixed_params (:obj:`tuple` or :obj:`list` of :obj:`bool`): The flag to set a parameter
184+
constant to its starting value during minimization.
185185
kwargs: Keyword arguments passed through to the optimizer API
186186
187187
Returns:

src/pyhf/infer/test_statistics.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -112,8 +112,8 @@ def qmu(mu, data, pdf, init_pars, par_bounds, fixed_params, return_fitted_pars=F
112112
par_bounds (:obj:`list` of :obj:`list`/:obj:`tuple`): The extrema of values the model parameters
113113
are allowed to reach in the fit.
114114
The shape should be ``(n, 2)`` for ``n`` model parameters.
115-
fixed_params (:obj:`list` of :obj:`bool`): The flag to set a parameter constant to its starting
116-
value during minimization.
115+
fixed_params (:obj:`tuple` or :obj:`list` of :obj:`bool`): The flag to set a parameter
116+
constant to its starting value during minimization.
117117
return_fitted_pars (:obj:`bool`): Return the best-fit parameter tensors
118118
the fixed-POI and unconstrained fits have converged on
119119
(i.e. :math:`\mu, \hat{\hat{\theta}}` and :math:`\hat{\mu}, \hat{\theta}`)
@@ -207,8 +207,8 @@ def qmu_tilde(
207207
par_bounds (:obj:`list` of :obj:`list`/:obj:`tuple`): The extrema of values the model parameters
208208
are allowed to reach in the fit.
209209
The shape should be ``(n, 2)`` for ``n`` model parameters.
210-
fixed_params (:obj:`list` of :obj:`bool`): The flag to set a parameter constant to its starting
211-
value during minimization.
210+
fixed_params (:obj:`tuple` or :obj:`list` of :obj:`bool`): The flag to set a parameter
211+
constant to its starting value during minimization.
212212
return_fitted_pars (:obj:`bool`): Return the best-fit parameter tensors
213213
the fixed-POI and unconstrained fits have converged on
214214
(i.e. :math:`\mu, \hat{\hat{\theta}}` and :math:`\hat{\mu}, \hat{\theta}`)
@@ -290,8 +290,8 @@ def tmu(mu, data, pdf, init_pars, par_bounds, fixed_params, return_fitted_pars=F
290290
par_bounds (:obj:`list` of :obj:`list`/:obj:`tuple`): The extrema of values the model parameters
291291
are allowed to reach in the fit.
292292
The shape should be ``(n, 2)`` for ``n`` model parameters.
293-
fixed_params (:obj:`list` of :obj:`bool`): The flag to set a parameter constant to its starting
294-
value during minimization.
293+
fixed_params (:obj:`tuple` or :obj:`list` of :obj:`bool`): The flag to set a parameter
294+
constant to its starting value during minimization.
295295
return_fitted_pars (:obj:`bool`): Return the best-fit parameter tensors
296296
the fixed-POI and unconstrained fits have converged on
297297
(i.e. :math:`\mu, \hat{\hat{\theta}}` and :math:`\hat{\mu}, \hat{\theta}`)
@@ -380,8 +380,8 @@ def tmu_tilde(
380380
par_bounds (:obj:`list` of :obj:`list`/:obj:`tuple`): The extrema of values the model parameters
381381
are allowed to reach in the fit.
382382
The shape should be ``(n, 2)`` for ``n`` model parameters.
383-
fixed_params (:obj:`list` of :obj:`bool`): The flag to set a parameter constant to its starting
384-
value during minimization.
383+
fixed_params (:obj:`tuple` or :obj:`list` of :obj:`bool`): The flag to set a parameter
384+
constant to its starting value during minimization.
385385
return_fitted_pars (:obj:`bool`): Return the best-fit parameter tensors
386386
the fixed-POI and unconstrained fits have converged on
387387
(i.e. :math:`\mu, \hat{\hat{\theta}}` and :math:`\hat{\mu}, \hat{\theta}`)
@@ -458,8 +458,8 @@ def q0(mu, data, pdf, init_pars, par_bounds, fixed_params, return_fitted_pars=Fa
458458
par_bounds (:obj:`list` of :obj:`list`/:obj:`tuple`): The extrema of values the model parameters
459459
are allowed to reach in the fit.
460460
The shape should be ``(n, 2)`` for ``n`` model parameters.
461-
fixed_params (:obj:`list` of :obj:`bool`): The flag to set a parameter constant to its starting
462-
value during minimization.
461+
fixed_params (:obj:`tuple` or :obj:`list` of :obj:`bool`): The flag to set a parameter
462+
constant to its starting value during minimization.
463463
return_fitted_pars (:obj:`bool`): Return the best-fit parameter tensors
464464
the fixed-POI and unconstrained fits have converged on
465465
(i.e. :math:`\mu, \hat{\hat{\theta}}` and :math:`\hat{\mu}, \hat{\theta}`)

src/pyhf/infer/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ def all_pois_floating(pdf, fixed_params):
2222
Args:
2323
pdf (~pyhf.pdf.Model): The statistical model adhering to the schema
2424
``model.json``.
25-
fixed_params (:obj:`list` or `tensor` of :obj:`bool`): Array of
25+
fixed_params (:obj:`tuple` or :obj:`list` of :obj:`bool`): Array of
2626
:obj:`bool` indicating if model parameters are fixed.
2727
2828
Returns:

0 commit comments

Comments
 (0)