Skip to content

Commit

Permalink
Added imputation warning to model
Browse files Browse the repository at this point in the history
  • Loading branch information
fonnesbeck committed Nov 7, 2018
1 parent cd453bc commit 916b34a
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions pymc3/model.py
Expand Up @@ -3,6 +3,7 @@
import itertools
import threading
import six
import warnings

import numpy as np
from pandas import Series
Expand Down Expand Up @@ -1259,6 +1260,10 @@ def as_tensor(data, name, model, distribution):
data = pandas_to_array(data).astype(dtype)

if hasattr(data, 'mask'):
missing_warning = ('Data in `{}` contain missing values and will be'
' automatically imputed from the sampling'
' distribution.'.format(name))
warnings.warn(missing_warning, UserWarning)
from .distributions import NoDistribution
testval = np.broadcast_to(distribution.default(), data.shape)[data.mask]
fakedist = NoDistribution.dist(shape=data.mask.sum(), dtype=dtype,
Expand Down

0 comments on commit 916b34a

Please sign in to comment.