In [7]:
import pymc as pm
from tools.plot import plot

slope = 2.
intercept = 1.
sample_points = 100
sigma = 0.1

@pm.deterministic
def linear(x, slope, intercept):
    return slope * x + intercept

xs = np.random.random(sample_points)
ys = linear(xs, slope, intercept)
ys += np.random.normal(scale=sigma, size=sample_points)

plot(lambda x: slope * x + intercept, (0,1))
pl.scatter(xs, ys)


---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-7-9da4cf5a0630> in <module>()
      7 sigma = 0.1
      8 
----> 9 @pm.deterministic
     10 def linear(x, slope, intercept):
     11     return slope * x + intercept

/usr/local/lib/python2.7/dist-packages/pymc/InstantiationDecorators.pyc in deterministic(__func__, **kwds)
    248 
    249     if __func__:
--> 250         return instantiate_n(__func__)
    251 
    252     return instantiate_n

/usr/local/lib/python2.7/dist-packages/pymc/InstantiationDecorators.pyc in instantiate_n(__func__)
    240     def instantiate_n(__func__):
    241         junk, parents = _extract(
--> 242             __func__, kwds, keys, 'Deterministic', probe=False)
    243         return Deterministic(parents=parents, **kwds)
    244 

/usr/local/lib/python2.7/dist-packages/pymc/InstantiationDecorators.pyc in _extract(__func__, kwds, keys, classname, probe)
    113             if i < arg_deficit - 1:
    114                 err_str += ','
--> 115         raise ValueError(err_str)
    116 
    117     # Fill in parent dictionary

ValueError: Deterministic linear: no parent provided for the following labels: x, slope, intercept

In [6]:
f = pm.Normal?yyyyyyyyyyyyyyyyxsxxx

In [ ]:
f = pm.Normal

In [ ]: