Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 0 additions & 69 deletions pymc/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@

import io
import urllib.request
import warnings

from collections.abc import Sequence
from copy import copy
Expand All @@ -40,10 +39,8 @@
from pymc.vartypes import isgenerator

__all__ = [
"ConstantData",
"Data",
"Minibatch",
"MutableData",
"get_data",
]
BASE_URL = "https://raw.githubusercontent.com/pymc-devs/pymc-examples/main/examples/data/{filename}"
Expand Down Expand Up @@ -218,74 +215,13 @@ def determine_coords(
return coords, new_dims


def ConstantData(
name: str,
value,
*,
dims: Sequence[str] | None = None,
coords: dict[str, Sequence | np.ndarray] | None = None,
infer_dims_and_coords=False,
**kwargs,
) -> TensorConstant:
"""Alias for ``pm.Data``.

Registers the ``value`` as a :class:`~pytensor.tensor.TensorConstant` with the model.
For more information, please reference :class:`pymc.Data`.
"""
warnings.warn(
"ConstantData is deprecated. All Data variables are now mutable. Use Data instead.",
FutureWarning,
)

var = Data(
name,
value,
dims=dims,
coords=coords,
infer_dims_and_coords=infer_dims_and_coords,
**kwargs,
)
return cast(TensorConstant, var)


def MutableData(
name: str,
value,
*,
dims: Sequence[str] | None = None,
coords: dict[str, Sequence | np.ndarray] | None = None,
infer_dims_and_coords=False,
**kwargs,
) -> SharedVariable:
"""Alias for ``pm.Data``.

Registers the ``value`` as a :class:`~pytensor.compile.sharedvalue.SharedVariable`
with the model. For more information, please reference :class:`pymc.Data`.
"""
warnings.warn(
"MutableData is deprecated. All Data variables are now mutable. Use Data instead.",
FutureWarning,
)

var = Data(
name,
value,
dims=dims,
coords=coords,
infer_dims_and_coords=infer_dims_and_coords,
**kwargs,
)
return cast(SharedVariable, var)


def Data(
name: str,
value,
*,
dims: Sequence[str] | None = None,
coords: dict[str, Sequence | np.ndarray] | None = None,
infer_dims_and_coords=False,
mutable: bool | None = None,
**kwargs,
) -> SharedVariable | TensorConstant:
"""Create a data container that registers a data variable with the model.
Expand Down Expand Up @@ -380,11 +316,6 @@ def Data(
"Pass them directly to `observed` if you want to trigger auto-imputation"
)

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

if isinstance(dims, str):
Expand Down
8 changes: 0 additions & 8 deletions pymc/distributions/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
# limitations under the License.
import functools
import re
import warnings

from collections.abc import Callable, Sequence

Expand Down Expand Up @@ -715,13 +714,6 @@ def __new__(
)
dist_params = cls.parse_dist_params(dist_params)
cls.check_valid_dist_random(dist, random, dist_params)
moment = kwargs.pop("moment", None)
if moment is not None:
warnings.warn(
"`moment` argument is deprecated. Use `support_point` instead.",
FutureWarning,
)
support_point = moment
if dist is not None:
kwargs.setdefault("class_name", f"CustomDist_{name}")
return _CustomSymbolicDist(
Expand Down
11 changes: 0 additions & 11 deletions pymc/distributions/dist_math.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@
@author: johnsalvatier
"""

import warnings

from collections.abc import Iterable
from functools import partial

Expand Down Expand Up @@ -419,12 +417,3 @@ def log_i0(x):
+ 11025.0 / (98304.0 * x**4.0)
),
)


def incomplete_beta(a, b, value):
warnings.warn(
"incomplete_beta has been deprecated. Use pytensor.tensor.betainc instead.",
FutureWarning,
stacklevel=2,
)
return pt.betainc(a, b, value)
7 changes: 2 additions & 5 deletions pymc/distributions/distribution.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
convert_observed_data,
floatX,
)
from pymc.util import UNSET, _add_future_warning_tag
from pymc.util import UNSET
from pymc.vartypes import continuous_types, string_types

__all__ = [
Expand Down Expand Up @@ -571,10 +571,7 @@ def dist(
ndim_supp = cls.rv_op(*dist_params, **kwargs).owner.op.ndim_supp

create_size = find_size(shape=shape, size=size, ndim_supp=ndim_supp)
rv_out = cls.rv_op(*dist_params, size=create_size, **kwargs)

_add_future_warning_tag(rv_out)
return rv_out
return cls.rv_op(*dist_params, size=create_size, **kwargs)


@node_rewriter([SymbolicRandomVariable])
Expand Down
2 changes: 0 additions & 2 deletions pymc/distributions/shape_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@

from pymc.exceptions import ShapeError
from pymc.pytensorf import PotentialShapeType
from pymc.util import _add_future_warning_tag


def to_tuple(shape):
Expand Down Expand Up @@ -264,7 +263,6 @@ def change_dist_size(

op = dist.owner.op
new_dist = _change_dist_size(op, dist, new_size=new_size, expand=expand)
_add_future_warning_tag(new_dist)

new_dist.name = dist.name
for k, v in dist.tag.__dict__.items():
Expand Down
30 changes: 0 additions & 30 deletions pymc/distributions/timeseries.py
Original file line number Diff line number Diff line change
Expand Up @@ -286,13 +286,6 @@ class GaussianRandomWalk(PredefinedRandomWalk):

@classmethod
def get_dists(cls, mu=0.0, sigma=1.0, *, init_dist=None, **kwargs):
if "init" in kwargs:
warnings.warn(
"init parameter is now called init_dist. Using init will raise an error in a future release.",
FutureWarning,
)
init_dist = kwargs.pop("init")

if init_dist is None:
warnings.warn(
"Initial distribution not specified, defaulting to `Normal.dist(0, 100)`."
Expand Down Expand Up @@ -340,14 +333,6 @@ class MvGaussianRandomWalk(PredefinedRandomWalk):

@classmethod
def get_dists(cls, mu, *, cov=None, tau=None, chol=None, lower=True, init_dist=None, **kwargs):
if "init" in kwargs:
warnings.warn(
"init parameter is now called init_dist. Using init will raise an error "
"in a future release.",
FutureWarning,
)
init_dist = kwargs.pop("init")

if init_dist is None:
warnings.warn(
"Initial distribution not specified, defaulting to `MvNormal.dist(0, I*100)`."
Expand Down Expand Up @@ -396,14 +381,6 @@ class MvStudentTRandomWalk(PredefinedRandomWalk):
def get_dists(
cls, *, nu, mu, scale=None, tau=None, chol=None, lower=True, init_dist=None, **kwargs
):
if "init" in kwargs:
warnings.warn(
"init parameter is now called init_dist. Using init will raise an error "
"in a future release.",
FutureWarning,
)
init_dist = kwargs.pop("init")

if init_dist is None:
warnings.warn(
"Initial distribution not specified, defaulting to `MvNormal.dist(0, I*100)`."
Expand Down Expand Up @@ -588,13 +565,6 @@ def dist(
sigma = pt.as_tensor_variable(sigma)
rhos = pt.atleast_1d(pt.as_tensor_variable(rho))

if "init" in kwargs:
warnings.warn(
"init parameter is now called init_dist. Using init will raise an error in a future release.",
FutureWarning,
)
init_dist = kwargs.pop("init")

ar_order = cls._get_ar_order(rhos=rhos, constant=constant, ar_order=ar_order)
steps = get_support_shape_1d(
support_shape=steps, shape=kwargs.get("shape", None), support_shape_offset=ar_order
Expand Down
25 changes: 1 addition & 24 deletions pymc/distributions/transforms.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import warnings

from functools import singledispatch

Expand Down Expand Up @@ -48,22 +47,6 @@
]


def __getattr__(name):
if name in ("univariate_ordered", "multivariate_ordered"):
warnings.warn(f"{name} has been deprecated, use ordered instead.", FutureWarning)
return ordered

if name in ("univariate_sum_to_1", "multivariate_sum_to_1"):
warnings.warn(f"{name} has been deprecated, use sum_to_1 instead.", FutureWarning)
return sum_to_1

if name == "RVTransform":
warnings.warn("RVTransform has been renamed to Transform", FutureWarning)
return Transform

raise AttributeError(f"module {__name__} has no attribute {name}")


@singledispatch
def _default_transform(op: Op, rv: TensorVariable):
"""Return default transform for a given Distribution `Op`."""
Expand Down Expand Up @@ -100,9 +83,7 @@ class Ordered(Transform):

name = "ordered"

def __init__(self, ndim_supp=None, positive=False, ascending=True):
if ndim_supp is not None:
warnings.warn("ndim_supp argument is deprecated and has no effect", FutureWarning)
def __init__(self, positive=False, ascending=True):
self.positive = positive
self.ascending = ascending

Expand Down Expand Up @@ -142,10 +123,6 @@ class SumTo1(Transform):

name = "sumto1"

def __init__(self, ndim_supp=None):
if ndim_supp is not None:
warnings.warn("ndim_supp argument is deprecated and has no effect", FutureWarning)

def backward(self, value, *inputs):
remaining = 1 - pt.sum(value[..., :], axis=-1, keepdims=True)
return pt.concatenate([value[..., :], remaining], axis=-1)
Expand Down
6 changes: 0 additions & 6 deletions pymc/initial_point.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,12 +240,6 @@ def make_initial_point_expression(
strategy = default_strategy

if isinstance(strategy, str):
if strategy == "moment":
strategy = "support_point"
warnings.warn(
"The 'moment' strategy is deprecated. Use 'support_point' instead.",
FutureWarning,
)
if strategy == "support_point":
try:
value = support_point(variable)
Expand Down
12 changes: 0 additions & 12 deletions pymc/logprob/abstract.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
# SOFTWARE.

import abc
import warnings

from collections.abc import Sequence
from functools import singledispatch
Expand All @@ -48,17 +47,6 @@
from pytensor.tensor.random.op import RandomVariable


def __getattr__(name):
if name == "MeasurableVariable":
warnings.warn(
f"{name} has been deprecated in favor of MeasurableOp. Importing will fail in a future release.",
FutureWarning,
)
return MeasurableOp

raise AttributeError(f"module {__name__} has no attribute {name}")


@singledispatch
def _logprob(
op: Op,
Expand Down
Loading