Giter Site home page Giter Site logo

whilemymcmcgentlysamples's Introduction

Pythonic Perambulations

This is the source of my Pythonic Perambulations blog. It is built using the Pelican blogging platform.

Requirements

  • Recent version of IPython. The liquid_tags plugin above requires IPython 1.0. Note that previously this could be built with the stand-alone nbconvert package. That no longer works with the recent liquid_tags plugin.

  • Recent version of Pelican. For the static paths (downloads, images, figures, etc.) to appear in the right place, Pelican 3.3+ must be used.

whilemymcmcgentlysamples's People

Contributors

a-rodin1 avatar aloctavodia avatar jakevdp avatar roger-yu-ds avatar twiecki avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

whilemymcmcgentlysamples's Issues

Cant run the Lasagne Example

Hi!

First of all i want to thank you for this material, I'm learning a lot from it, and kind falling in love with probabilistic programming :D

I have a problem running the Lasange example. when i try to run this part :

with pm.Model() as neural_network:
    likelihood = build_ann(GaussWeights())
    v_params, trace, ppc, y_pred = run_advi(likelihood)

It gives this error:

/usr/local/lib/python2.7/dist-packages/pymc3/variational/advi_minibatch.pyc in advi_minibatch(vars, start, model, n, n_mcsamples, minibatch_RVs, minibatch_tensors, minibatches, global_RVs, local_RVs, observed_RVs, encoder_params, total_size, optimizer, learning_rate, epsilon, random_seed, mode)
    476     if global_RVs is None:
    477         global_RVs = OrderedDict({v: 1 for v in grvs})
--> 478     _value_error(len(grvs) == len(global_RVs(),
    479                  'global_RVs ({}) must have all global RVs: {}'.format(
    480                      [v for v in global_RVs], grvs)

TypeError: 'OrderedDict' object is not callable

Any idea how can i fix it?

Thanks in advance

name 'Xt' is not defined

i get the above error for the below part.

with neural_network:
inference = pm.ADVI()
mean_field = pm.fit(method='advi', n=1,
callbacks=[pm.callbacks.CheckParametersConvergence(diff='relative')])
approx = inference.approx
test_probs = approx.sample_node(act_out, more_replacements={Xt: grid_2d})
eval_tracker = pm.callbacks.Tracker(
test_probs=test_probs.eval,
)
inference.fit(method='advi', n=5,
callbacks=[pm.callbacks.CheckParametersConvergence(diff='relative'),
eval_tracker])

##############################
i am not sure what define Xt as. and when i define it as Xt = theano.shared(X_test) it gives me an error

TypeError Traceback (most recent call last)
in ()
12 inference.fit(method='advi', n=5,
13 callbacks=[pm.callbacks.CheckParametersConvergence(diff='relative'),
---> 14 eval_tracker])

C:\ProgramData\Anaconda3\lib\site-packages\pymc3\variational\inference.py in fit(self, n, score, callbacks, progressbar, **kwargs)
121 callbacks = []
122 score = self._maybe_score(score)
--> 123 step_func = self.objective.step_function(score=score, **kwargs)
124 progress = tqdm.trange(n, disable=not progressbar)
125 if score:

C:\ProgramData\Anaconda3\lib\site-packages\pymc3\memoize.py in memoizer(*args, **kwargs)
14
15 if key not in cache:
---> 16 cache[key] = obj(*args, **kwargs)
17
18 return cache[key]

C:\ProgramData\Anaconda3\lib\site-packages\theano\configparser.py in res(*args, **kwargs)
115 def res(*args, **kwargs):
116 with self:
--> 117 return f(*args, **kwargs)
118 return res
119

TypeError: step_function() got an unexpected keyword argument 'method'

#####################################

this is for the following notebook
https://github.com/twiecki/WhileMyMCMCGentlySamples/blob/master/content/downloads/notebooks/bayesian_neural_network.ipynb

Syntax error in bayesian_neural_network.ipynb

This line:

contour = ax.contourf(*grid, ppc['out'].mean(axis=0).reshape(100, 100), cmap=cmap)

Should be

X, Y = grid
contour = ax.contourf(X, Y, ppc['out'].mean(axis=0).reshape(100, 100), cmap=cmap)

Is it python2.7 problem that I got this error ?

@twiecki
Thanks for the example and talks on pydata 2016
I tried to run bayesian_neural_network.v3.ipynb but I got this error :

contour = ax.contourf(*grid, ppc['out'].mean(axis=0).reshape(100, 100), cmap=cmap)

SyntaxError: only named arguments may follow *expression

Is it the python2.7 problem ?

=> Oh yes, its unpacking in python2.7
contour = ax.contourf(grid[0],grid[1], ppc['out'].mean(axis=0).reshape(100, 100), cmap=cmap) solve my question

Possibly a known issue between Python3 and Python2 maybe?

Thomas,
While running your code as is using python 2.7 I get an error about datatype. I am terribly raw at this stage of my learning. Can you help?
The error message is:
The error when converting the test value to that variable type:
TensorType(float32, vector) cannot store a value of dtype float64 without risking loss of precision. If you do not mind this loss, you can: 1) explicitly cast your data to float32, or 2) set "allow_input_downcast=True" when calling "function". Value: "array([-0.95235633, -0.62635576, -0.72617398, ..., -0.64619409,
-0.0781143 , -0.52644389])"
Backend being used is Theano in my case

Never mind Thomas,
This issue can safely be closed. It looks like if I force downcasting my X and Ys using .astype('float32') it works but not with .astype(np.float32)

random_walk_deep_net.ipynb

Hallo Thomas,

Ist es möglich vom - random_walk_deep_net.ipynb eine Version mit Finanzdaten von yfinance zu machen? Zum Beispiel vom SPY 500 oder dem DAX 40?

Das Projekt ist hochinteressant und sehr innovativ, aber ich selber schaffe es wohl kaum das Notebook entsprechend anzupassen. Ich habe schon länger nach einer Art und Weise gesucht, die nicht explizit verlangt das man ein estimation window oder Schätzfenster festlegt und sich damit an die aktuelle Marktsituation anpassen kann. Eigentlich hatte ich die Hoffnung darauf schon fast aufgegeben.

Das MAP nicht sehr gut funktioniert macht für mich übrigens intuitiv sehr viel Sinn.

Am allerbesten wäre es falls auch gezeigt werden könnte wie man dann nach dem Training auch die aktuellen Vorhersagen treffen kann.

Falls du https://www.buymeacoffee.com/ zu deiner Seite hinzufügst dann kann ich dir damit einen Kaffee spendieren.

Vielen Lieben Dank und Grüße

array reshape

the below line of code provides the following error

contour = ax.contourf(X1_grid, X2_grid, out_sample.eval().mean(axis=0).reshape(100, 100), cmap=cmap)

ValueError: cannot reshape array of size 100 into shape (100,100)
i am not sure what the issue is

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.