Skip to content

Commit f6bfdfd

Browse files
committed
Remove deprecated functionality
1 parent 0f1bfa9 commit f6bfdfd

29 files changed

+45
-719
lines changed

pymc/data.py

Lines changed: 0 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414

1515
import io
1616
import urllib.request
17-
import warnings
1817

1918
from collections.abc import Sequence
2019
from copy import copy
@@ -40,10 +39,8 @@
4039
from pymc.vartypes import isgenerator
4140

4241
__all__ = [
43-
"ConstantData",
4442
"Data",
4543
"Minibatch",
46-
"MutableData",
4744
"get_data",
4845
]
4946
BASE_URL = "https://raw.githubusercontent.com/pymc-devs/pymc-examples/main/examples/data/{filename}"
@@ -218,74 +215,13 @@ def determine_coords(
218215
return coords, new_dims
219216

220217

221-
def ConstantData(
222-
name: str,
223-
value,
224-
*,
225-
dims: Sequence[str] | None = None,
226-
coords: dict[str, Sequence | np.ndarray] | None = None,
227-
infer_dims_and_coords=False,
228-
**kwargs,
229-
) -> TensorConstant:
230-
"""Alias for ``pm.Data``.
231-
232-
Registers the ``value`` as a :class:`~pytensor.tensor.TensorConstant` with the model.
233-
For more information, please reference :class:`pymc.Data`.
234-
"""
235-
warnings.warn(
236-
"ConstantData is deprecated. All Data variables are now mutable. Use Data instead.",
237-
FutureWarning,
238-
)
239-
240-
var = Data(
241-
name,
242-
value,
243-
dims=dims,
244-
coords=coords,
245-
infer_dims_and_coords=infer_dims_and_coords,
246-
**kwargs,
247-
)
248-
return cast(TensorConstant, var)
249-
250-
251-
def MutableData(
252-
name: str,
253-
value,
254-
*,
255-
dims: Sequence[str] | None = None,
256-
coords: dict[str, Sequence | np.ndarray] | None = None,
257-
infer_dims_and_coords=False,
258-
**kwargs,
259-
) -> SharedVariable:
260-
"""Alias for ``pm.Data``.
261-
262-
Registers the ``value`` as a :class:`~pytensor.compile.sharedvalue.SharedVariable`
263-
with the model. For more information, please reference :class:`pymc.Data`.
264-
"""
265-
warnings.warn(
266-
"MutableData is deprecated. All Data variables are now mutable. Use Data instead.",
267-
FutureWarning,
268-
)
269-
270-
var = Data(
271-
name,
272-
value,
273-
dims=dims,
274-
coords=coords,
275-
infer_dims_and_coords=infer_dims_and_coords,
276-
**kwargs,
277-
)
278-
return cast(SharedVariable, var)
279-
280-
281218
def Data(
282219
name: str,
283220
value,
284221
*,
285222
dims: Sequence[str] | None = None,
286223
coords: dict[str, Sequence | np.ndarray] | None = None,
287224
infer_dims_and_coords=False,
288-
mutable: bool | None = None,
289225
**kwargs,
290226
) -> SharedVariable | TensorConstant:
291227
"""Create a data container that registers a data variable with the model.
@@ -380,11 +316,6 @@ def Data(
380316
"Pass them directly to `observed` if you want to trigger auto-imputation"
381317
)
382318

383-
if mutable is not None:
384-
warnings.warn(
385-
"Data is now always mutable. Specifying the `mutable` kwarg will raise an error in a future release",
386-
FutureWarning,
387-
)
388319
x = pytensor.shared(arr, name, **kwargs)
389320

390321
if isinstance(dims, str):

pymc/distributions/custom.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
# limitations under the License.
1414
import functools
1515
import re
16-
import warnings
1716

1817
from collections.abc import Callable, Sequence
1918

@@ -715,13 +714,6 @@ def __new__(
715714
)
716715
dist_params = cls.parse_dist_params(dist_params)
717716
cls.check_valid_dist_random(dist, random, dist_params)
718-
moment = kwargs.pop("moment", None)
719-
if moment is not None:
720-
warnings.warn(
721-
"`moment` argument is deprecated. Use `support_point` instead.",
722-
FutureWarning,
723-
)
724-
support_point = moment
725717
if dist is not None:
726718
kwargs.setdefault("class_name", f"CustomDist_{name}")
727719
return _CustomSymbolicDist(

pymc/distributions/dist_math.py

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@
1818
@author: johnsalvatier
1919
"""
2020

21-
import warnings
22-
2321
from collections.abc import Iterable
2422
from functools import partial
2523

@@ -419,12 +417,3 @@ def log_i0(x):
419417
+ 11025.0 / (98304.0 * x**4.0)
420418
),
421419
)
422-
423-
424-
def incomplete_beta(a, b, value):
425-
warnings.warn(
426-
"incomplete_beta has been deprecated. Use pytensor.tensor.betainc instead.",
427-
FutureWarning,
428-
stacklevel=2,
429-
)
430-
return pt.betainc(a, b, value)

pymc/distributions/distribution.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060
convert_observed_data,
6161
floatX,
6262
)
63-
from pymc.util import UNSET, _add_future_warning_tag
63+
from pymc.util import UNSET
6464
from pymc.vartypes import continuous_types, string_types
6565

6666
__all__ = [
@@ -571,10 +571,7 @@ def dist(
571571
ndim_supp = cls.rv_op(*dist_params, **kwargs).owner.op.ndim_supp
572572

573573
create_size = find_size(shape=shape, size=size, ndim_supp=ndim_supp)
574-
rv_out = cls.rv_op(*dist_params, size=create_size, **kwargs)
575-
576-
_add_future_warning_tag(rv_out)
577-
return rv_out
574+
return cls.rv_op(*dist_params, size=create_size, **kwargs)
578575

579576

580577
@node_rewriter([SymbolicRandomVariable])

pymc/distributions/shape_utils.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@
4343

4444
from pymc.exceptions import ShapeError
4545
from pymc.pytensorf import PotentialShapeType
46-
from pymc.util import _add_future_warning_tag
4746

4847

4948
def to_tuple(shape):
@@ -264,7 +263,6 @@ def change_dist_size(
264263

265264
op = dist.owner.op
266265
new_dist = _change_dist_size(op, dist, new_size=new_size, expand=expand)
267-
_add_future_warning_tag(new_dist)
268266

269267
new_dist.name = dist.name
270268
for k, v in dist.tag.__dict__.items():

pymc/distributions/timeseries.py

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -286,13 +286,6 @@ class GaussianRandomWalk(PredefinedRandomWalk):
286286

287287
@classmethod
288288
def get_dists(cls, mu=0.0, sigma=1.0, *, init_dist=None, **kwargs):
289-
if "init" in kwargs:
290-
warnings.warn(
291-
"init parameter is now called init_dist. Using init will raise an error in a future release.",
292-
FutureWarning,
293-
)
294-
init_dist = kwargs.pop("init")
295-
296289
if init_dist is None:
297290
warnings.warn(
298291
"Initial distribution not specified, defaulting to `Normal.dist(0, 100)`."
@@ -340,14 +333,6 @@ class MvGaussianRandomWalk(PredefinedRandomWalk):
340333

341334
@classmethod
342335
def get_dists(cls, mu, *, cov=None, tau=None, chol=None, lower=True, init_dist=None, **kwargs):
343-
if "init" in kwargs:
344-
warnings.warn(
345-
"init parameter is now called init_dist. Using init will raise an error "
346-
"in a future release.",
347-
FutureWarning,
348-
)
349-
init_dist = kwargs.pop("init")
350-
351336
if init_dist is None:
352337
warnings.warn(
353338
"Initial distribution not specified, defaulting to `MvNormal.dist(0, I*100)`."
@@ -396,14 +381,6 @@ class MvStudentTRandomWalk(PredefinedRandomWalk):
396381
def get_dists(
397382
cls, *, nu, mu, scale=None, tau=None, chol=None, lower=True, init_dist=None, **kwargs
398383
):
399-
if "init" in kwargs:
400-
warnings.warn(
401-
"init parameter is now called init_dist. Using init will raise an error "
402-
"in a future release.",
403-
FutureWarning,
404-
)
405-
init_dist = kwargs.pop("init")
406-
407384
if init_dist is None:
408385
warnings.warn(
409386
"Initial distribution not specified, defaulting to `MvNormal.dist(0, I*100)`."
@@ -588,13 +565,6 @@ def dist(
588565
sigma = pt.as_tensor_variable(sigma)
589566
rhos = pt.atleast_1d(pt.as_tensor_variable(rho))
590567

591-
if "init" in kwargs:
592-
warnings.warn(
593-
"init parameter is now called init_dist. Using init will raise an error in a future release.",
594-
FutureWarning,
595-
)
596-
init_dist = kwargs.pop("init")
597-
598568
ar_order = cls._get_ar_order(rhos=rhos, constant=constant, ar_order=ar_order)
599569
steps = get_support_shape_1d(
600570
support_shape=steps, shape=kwargs.get("shape", None), support_shape_offset=ar_order

pymc/distributions/transforms.py

Lines changed: 1 addition & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
14-
import warnings
1514

1615
from functools import singledispatch
1716

@@ -48,22 +47,6 @@
4847
]
4948

5049

51-
def __getattr__(name):
52-
if name in ("univariate_ordered", "multivariate_ordered"):
53-
warnings.warn(f"{name} has been deprecated, use ordered instead.", FutureWarning)
54-
return ordered
55-
56-
if name in ("univariate_sum_to_1", "multivariate_sum_to_1"):
57-
warnings.warn(f"{name} has been deprecated, use sum_to_1 instead.", FutureWarning)
58-
return sum_to_1
59-
60-
if name == "RVTransform":
61-
warnings.warn("RVTransform has been renamed to Transform", FutureWarning)
62-
return Transform
63-
64-
raise AttributeError(f"module {__name__} has no attribute {name}")
65-
66-
6750
@singledispatch
6851
def _default_transform(op: Op, rv: TensorVariable):
6952
"""Return default transform for a given Distribution `Op`."""
@@ -100,9 +83,7 @@ class Ordered(Transform):
10083

10184
name = "ordered"
10285

103-
def __init__(self, ndim_supp=None, positive=False, ascending=True):
104-
if ndim_supp is not None:
105-
warnings.warn("ndim_supp argument is deprecated and has no effect", FutureWarning)
86+
def __init__(self, positive=False, ascending=True):
10687
self.positive = positive
10788
self.ascending = ascending
10889

@@ -142,10 +123,6 @@ class SumTo1(Transform):
142123

143124
name = "sumto1"
144125

145-
def __init__(self, ndim_supp=None):
146-
if ndim_supp is not None:
147-
warnings.warn("ndim_supp argument is deprecated and has no effect", FutureWarning)
148-
149126
def backward(self, value, *inputs):
150127
remaining = 1 - pt.sum(value[..., :], axis=-1, keepdims=True)
151128
return pt.concatenate([value[..., :], remaining], axis=-1)

pymc/initial_point.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -240,12 +240,6 @@ def make_initial_point_expression(
240240
strategy = default_strategy
241241

242242
if isinstance(strategy, str):
243-
if strategy == "moment":
244-
strategy = "support_point"
245-
warnings.warn(
246-
"The 'moment' strategy is deprecated. Use 'support_point' instead.",
247-
FutureWarning,
248-
)
249243
if strategy == "support_point":
250244
try:
251245
value = support_point(variable)

pymc/logprob/abstract.py

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@
3535
# SOFTWARE.
3636

3737
import abc
38-
import warnings
3938

4039
from collections.abc import Sequence
4140
from functools import singledispatch
@@ -48,17 +47,6 @@
4847
from pytensor.tensor.random.op import RandomVariable
4948

5049

51-
def __getattr__(name):
52-
if name == "MeasurableVariable":
53-
warnings.warn(
54-
f"{name} has been deprecated in favor of MeasurableOp. Importing will fail in a future release.",
55-
FutureWarning,
56-
)
57-
return MeasurableOp
58-
59-
raise AttributeError(f"module {__name__} has no attribute {name}")
60-
61-
6250
@singledispatch
6351
def _logprob(
6452
op: Op,

0 commit comments

Comments
 (0)