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 authored and twiecki committed Nov 9, 2018
1 parent cd453bc commit 54cd1e7
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions pymc3/model.py
Original file line number Diff line number Diff line change
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'):
impute_message = ('Data in {name} contains missing values and'
' will be automatically imputed from the'
' sampling distribution.'.format(name=name))
warnings.warn(impute_message, 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 54cd1e7

Please sign in to comment.