pymc-user Mailing List for PyMC
Status: Beta
Brought to you by:
fonnesbeck
You can subscribe to this list here.
2004 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(1) |
Dec
|
---|---|---|---|---|---|---|---|---|---|---|---|---|
2005 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(1) |
2006 |
Jan
|
Feb
(5) |
Mar
(1) |
Apr
(5) |
May
(2) |
Jun
|
Jul
(1) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Christopher F. <fon...@ma...> - 2006-07-14 22:26:42
|
Hi everyone, I am in the midst of revising the PyMC user's manual in anticipation of the official 1.0 release. If any users have suggestions or errata to report, now would be an ideal time. I am planning on adding a few more examples for the new document, and generally fleshing out some of the methodology. Thanks, C. -- Christopher Fonnesbeck + Atlanta, GA + fonnesbeck at mac.com + Contact me on AOL IM using email address |
From: Christopher F. <ch...@tr...> - 2006-05-17 03:00:33
|
On May 15, 2006, at 7:20 PM, Seth de l'Isle wrote: > Hello, > > I was expecting a poisson prior to limit a parameter to possitive > values > much like using the exponential prior would. Instead it halted > processing. > >>>> from PyMC.MCMC import * >>>> class foo(MetropolisHastings): pass > ... >>>> f = foo() >>>> f.exponential_prior(-1, 5) > nan >>>> f.poisson_prior(-1, 5) > PAUSE negative factorial in factln statement executed > To resume execution, type go. Other input will terminate the job. > > STOP > > Shouldn't poisson_prior and poisson_like return nan as well? Hi Seth, Thats a good point. At the moment, the likelihoods only enforce the parameters of the distribution, and not the data. I essentially leave it up to the user not to pass negative data values. Part of the reason for this is to avoid as much checking as possible (i.e. "if" statements), as this slows down the model. C. -- Christopher J. Fonnesbeck, Ph.D. Population Ecologist, Marine Mammal Section Fish & Wildlife Research Institute (FWC) St. Petersburg, FL Adjunct Assistant Professor Warnell School of Forestry and Natural Resources University of Georgia Athens, GA T: 727.235.5570 E: chris at trichech.us |
From: Seth de l'I. <sz...@ub...> - 2006-05-15 23:20:04
|
Hello, I was expecting a poisson prior to limit a parameter to possitive values much like using the exponential prior would. Instead it halted processing. >>> from PyMC.MCMC import * >>> class foo(MetropolisHastings): pass ... >>> f = foo() >>> f.exponential_prior(-1, 5) nan >>> f.poisson_prior(-1, 5) PAUSE negative factorial in factln statement executed To resume execution, type go. Other input will terminate the job. STOP Shouldn't poisson_prior and poisson_like return nan as well? Thanks, Seth -- Listen and be Heard http://PopularVoice.Org Media Reform : Participatory Journalism : Populism |
From: David H. <dav...@gm...> - 2006-04-27 13:32:38
|
Hi, I'm using PyMC to sample from the distribution of two parameters, one whose domain is about [0,2] and the other [300,600]. Since they are correlated, I'm block updating the two together, ie. self.parameters('AB', init_val =3D [1, 500]) It appears that doing this is not efficient, in the sense that the jumps fo= r B are of the same order than for A. Hence, it takes a very long time to converge to the stationary distribution. Taking the log of B has allowed me to cut the number of simulations dramatically. Is this normal ? I thought that each parameter would get its own jump variance, with a correlation coefficient linking the two. Thanks, David |
From: Christopher F. <ch...@tr...> - 2006-04-21 18:56:17
|
On Apr 21, 2006, at 9:02 AM, Hanno Klemm wrote: > > I understand that the parameters to be estimated are defined via the > sample.parameter method. There I can define a proposed distribution > via dist='some_dist'. However, 'some_dist' needs to be zero-centered, > if I understand the comment in the code correctly. What is the best > way of dealing with a case where you want to have your parameters > greater-equal than zero? Or am I missing the point completely? Well, in theory the proposal distribution is arbitrary -- it can literally be any distribution over the support of the parameter. In practice, however, some distributions work better than others. A noncentral proposal distribution is fine, but it may not converge as efficiently as a central one. I can't think of a reason a priori that you would want to have a nonzero expected value, but perhaps you have one. At the moment, 3 proposal distributions are built-in to PyMC: normal (the default), uniform, and double exponential. The double exponential proposal is interesting because it will occasionally propose extreme values, due to its long tails, which can help avoid metastable behaviour. I plan on releasing, with the official 1.0 version, a more comprehensive user's guide that will rather explicitly lay all this out. Regards, Chris -- Christopher J. Fonnesbeck Population Ecologist, Marine Mammal Section Fish & Wildlife Research Institute (FWC) St. Petersburg, FL Adjunct Assistant Professor Warnell School of Forest Resources University of Georgia Athens, GA T: 727.235.5570 E: chris at trichech.us |
From: Hanno K. <kl...@ph...> - 2006-04-21 13:02:25
|
Hi Christopher, thanks for the quick reply. Another question is bothering me at the moment (this time maybe a little less technical): I understand that the parameters to be estimated are defined via the sample.parameter method. There I can define a proposed distribution via dist='some_dist'. However, 'some_dist' needs to be zero-centered, if I understand the comment in the code correctly. What is the best way of dealing with a case where you want to have your parameters greater-equal than zero? Or am I missing the point completely? Best regards, Hanno Christopher Fonnesbeck <ch...@tr...> said: > On Apr 21, 2006, at 5:24 AM, Hanno Klemm wrote: > > > Is there a deeper reason for "hard-wiring" TkAgg usage into PyMC and > > are there further problems down the road I have to anticipate with my > > approach? > > Hello Hanno, > > The only reason TkAgg is hard-wired into PyMC is that it was a better > default than WxAgg, since Tkinter is easy to install on most systems > (unlike WXpython), and even comes built in to some python > distributions, like ActiveState. There should be no problem in > choosing another backend. > > Good luck, > Chris > > -- > Christopher J. Fonnesbeck > > Population Ecologist, Marine Mammal Section > Fish & Wildlife Research Institute (FWC) > St. Petersburg, FL > > Adjunct Assistant Professor > Warnell School of Forest Resources > University of Georgia > Athens, GA > > T: 727.235.5570 > E: chris at trichech.us > > > -- Hanno Klemm kl...@ph... |
From: Christopher F. <ch...@tr...> - 2006-04-21 10:52:29
|
On Apr 21, 2006, at 5:24 AM, Hanno Klemm wrote: > Is there a deeper reason for "hard-wiring" TkAgg usage into PyMC and > are there further problems down the road I have to anticipate with my > approach? Hello Hanno, The only reason TkAgg is hard-wired into PyMC is that it was a better default than WxAgg, since Tkinter is easy to install on most systems (unlike WXpython), and even comes built in to some python distributions, like ActiveState. There should be no problem in choosing another backend. Good luck, Chris -- Christopher J. Fonnesbeck Population Ecologist, Marine Mammal Section Fish & Wildlife Research Institute (FWC) St. Petersburg, FL Adjunct Assistant Professor Warnell School of Forest Resources University of Georgia Athens, GA T: 727.235.5570 E: chris at trichech.us |
From: Hanno K. <kl...@ph...> - 2006-04-21 09:24:54
|
Hi, I have just started toying around with PyMC. However, I ran directly in the beginning into a catch: I don't have Tkinter installed for various reasons. This throws up an error when importing PyMC, because it wants the TkAgg backend of matplotlib to be used. However, after changing use('TkAgg') into use('GTK') in Matplot.py and setting interactive=True in matplotlibrc, everything works well. Is there a deeper reason for "hard-wiring" TkAgg usage into PyMC and are there further problems down the road I have to anticipate with my approach? Thanks, Hanno -- Hanno Klemm kl...@ph... |
From: Christopher F. <ch...@tr...> - 2006-03-31 15:21:31
|
Hi all, I'm preparing the official 1.0 release of PyMC, scheduled hopefully for next week. The aim of this release is not to introduce a whole crop of new features, but rather, to make the existing feature set relatively solid and devoid of bugs. So, if anyone has any bugs to report, or usability concerns, either major or minor, now is the time to pass them along. This includes any likelihood distributions that are missing which you feel should be included. One thing that will accompany the release is an updated user's guide, as well as a step-by-step online tutorial for building models in PyMC. Thanks, Chris -- Christopher J. Fonnesbeck Population Ecologist, Marine Mammal Section Fish & Wildlife Research Institute (FWC) St. Petersburg, FL Adjunct Assistant Professor Warnell School of Forest Resources University of Georgia Athens, GA T: 727.235.5570 E: chris at trichech.us |
From: David H. <dav...@gm...> - 2006-02-24 19:19:51
|
Thanks Chris, Just so I understand correctly, does specyfing p =3D [A,B] means that A,B are updated using bivariate normal jumps with a correlation coefficient that is tuned along with the covariances ? Also, I'm planning to use PyMC to do mixed Gibbs-Metropolis sampling.=20 That is, some parameters would be sampled directly from a distribution and others would be chosen via MH jumping rules. If I ever get there, I could write a little how-to for inclusion in the PyMC tutorial. Would that be of any interest to you ? Thanks, David 2006/2/24, Chris Fonnesbeck <fon...@gm...>: > On 2/15/06, David Huard <dav...@et...> wrote: > > I have a model with two parameters A and B. When I compute their > > distribution using PyMC, I get a 'cigar' distribution, in other words, > > parameters A and B are strongly correlated. I figure this must put a st= rain > > on the routine, forcing it to decrease the jump radius to maintain an > > acceptable acceptance ratio. Is there a way to indicate that those > > parameters are correlated and to use a multivariate distribution for th= e > > jumps ? > > > > Sorry for the late reply. The best way to deal with highly correlated > parameters is to block update -- i.e. sample them together. Thus, > rather than have A and B, you can just specify a vector-valued > parameter A with init_val =3D [x, y]. Of course, this assumes A and B > both use the same likelihood function. Is this the case? I should > probably add the ability to block update among arbitrary parameters. > > > P.S. Adding the generalized extreme distribution to flib would sure be > > appreciated. > > Look for it in the next release. > > C. > > -- > Chris Fonnesbeck + Atlanta, GA + http://trichech.us > > > ------------------------------------------------------- > This SF.Net email is sponsored by xPML, a groundbreaking scripting langua= ge > that extends applications into web and mobile media. Attend the live webc= ast > and join the prime developer group breaking into this new coding territor= y! > http://sel.as-us.falkag.net/sel?cmdlnk&kid=110944&bid$1720&dat=121642 > _______________________________________________ > Pymc-user mailing list > Pym...@li... > https://lists.sourceforge.net/lists/listinfo/pymc-user > |
From: Chris F. <fon...@gm...> - 2006-02-24 16:29:35
|
On 2/15/06, David Huard <dav...@et...> wrote: > I have a model with two parameters A and B. When I compute their > distribution using PyMC, I get a 'cigar' distribution, in other words, > parameters A and B are strongly correlated. I figure this must put a stra= in > on the routine, forcing it to decrease the jump radius to maintain an > acceptable acceptance ratio. Is there a way to indicate that those > parameters are correlated and to use a multivariate distribution for the > jumps ? > Sorry for the late reply. The best way to deal with highly correlated parameters is to block update -- i.e. sample them together. Thus, rather than have A and B, you can just specify a vector-valued parameter A with init_val =3D [x, y]. Of course, this assumes A and B both use the same likelihood function. Is this the case? I should probably add the ability to block update among arbitrary parameters. > P.S. Adding the generalized extreme distribution to flib would sure be > appreciated. Look for it in the next release. C. -- Chris Fonnesbeck + Atlanta, GA + http://trichech.us |
From: David H. <dav...@gm...> - 2006-02-24 14:39:12
|
I doubt this is the easy way to do what you want. I'd rather build a model with known statistical distribution and generate random variables. For instante : 1. Generate random gender (0 or 1) with a Bernouilli distribution with parameter p, the proportion of men. 2. Generate age, according to gender. Try to find data for a given population and simply draw randomly from it. 3. Generate income (dependent on gender and age) This is the tricky part, there are many distributions that can model correlation, (bivariate gumbel, bivariate normal, copulas), but you'll have to specify a model for the correlation anyway. I doubt a linear correlation would do... 4. Same problem for outcome. You'll find a wide array of distributions to generate randomly from in scipy.stats and in the random module. Cheers, David 2006/2/24, Hugo Koopmans <hug...@gm...>: > Hi there, > > I have done some experiments with PyMC. Has been working very well so far= , > keep up the good work!!! > > Now, I want to use PyMC to generate data to do experiments with missing > values. Therefore I need to generate toy data first. > This toydata for example could consist of the following variables: > age, income and gender and an outcome (e.g. change of buying product X) > now I would like to have an underlying model to generate data from in whi= ch > for instance age and income are correlated in some way and females like t= he > product more then males. Also the correlation between income and age is > stronger for females then for males. > > Would this be possible using PyMC? Did anyone do something like this? Sam= ple > code would be appriciated very much! > > Regards, > > hugo |
From: Hugo K. <hug...@gm...> - 2006-02-24 09:45:54
|
Hi there, I have done some experiments with PyMC. Has been working very well so far, keep up the good work!!! Now, I want to use PyMC to *generate* data to do experiments with missing values. Therefore I need to generate toy data first. This toydata for example could consist of the following variables: age, income and gender and an outcome (e.g. change of buying product X) now I would like to have an underlying model to generate data from in which for instance age and income are correlated in some way and females like the product more then males. Also the correlation between income and age is stronger for females then for males. Would this be possible using PyMC? Did anyone do something like this? Sampl= e code would be appriciated very much! Regards, hugo |
From: David H. <dav...@et...> - 2006-02-15 18:48:38
|
I have a model with two parameters A and B. When I compute their distribution using PyMC, I get a 'cigar' distribution, in other words, parameters A and B are strongly correlated. I figure this must put a strain on the routine, forcing it to decrease the jump radius to maintain an acceptable acceptance ratio. Is there a way to indicate that those parameters are correlated and to use a multivariate distribution for the jumps ? Thanks, David P.S. Adding the generalized extreme distribution to flib would sure be appreciated. |
From: David H. <dav...@gm...> - 2005-12-07 18:56:45
|
Hi, does someone know how to use PyMC with the new scipy core ? It seems that arrays are float64 by default and the functions in Numeric only take float32... The effect is that in the method summary, the mean and variance cannot be computed since they take only 32 bit floats... Thanks, David |
From: Chris F. <fon...@gm...> - 2004-11-10 00:42:17
|
Sorry for the extreme lateness of this reply -- as you can see, there is little traffic on these lists. There are now windows installers for PyMC, so the easiest route is simply to install that. If you prefer to build it yourself, the appropriate command is: python setup.py build --compiler=mingw32 install Hope that helps. Chris |
From: Razafindrakoto J. C. <Jea...@ax...> - 2004-06-29 16:51:39
|
=20 When trying to install PyMC, I get the following message error. Does anyone can help ? =20 Regards, =20 JCR =20 =20 D:\Razafindrakoto\PythonEnthought\Lib\site-packages\PyMC-0.2.6>python setup.py install running install running build running config_fc running build_src building extension "PyMC.flib" sources f2py:> build\src\flibmodule.c creating build creating build\src Reading fortran codes... Reading file 'PyMC/flib.f' Post-processing... Block: flib Block: poisson Block: binomial Block: normal Block: wishart Block: mvnorm Block: trace Block: gamma Block: trans Block: matmult Block: chol Block: dtrm Block: elgs Building modules... Building module "flib"... Constructing wrapper function "poisson"... like =3D poisson(x,mu) Constructing wrapper function "binomial"... like =3D binomial(x,n,p) Constructing wrapper function "normal"... like =3D normal(x,mu,tau) Constructing wrapper function "wishart"... like =3D wishart(x,alpha,beta) Constructing wrapper function "mvnorm"... like =3D mvnorm(x,mu,tau) Constructing wrapper function "trace"... trace(mat,tr,[k]) Constructing wrapper function "gamma"... gx =3D gamma(xx) Constructing wrapper function "trans"... tmat =3D trans(mat) Constructing wrapper function "matmult"... prod =3D matmult(mat1,mat2) Constructing wrapper function "chol"... c =3D chol(a) Constructing wrapper function "dtrm"... d =3D dtrm(a) Constructing wrapper function "elgs"... elgs(a,indx,[n]) Wrote C/API module "flib" to file "build\src/flibmodule.c" adding 'build\src\fortranobject.c' to sources. adding 'build\src' to include_dirs. copying D:\RAZAFI~1\PYTHON~1\lib\site-packages\f2py2e\src\fortranobje= ct.c -> bui ld\src copying D:\RAZAFI~1\PYTHON~1\lib\site-packages\f2py2e\src\fortranobje= ct.h -> bui ld\src running build_py creating build\lib.win32-2.3 creating build\lib.win32-2.3\PyMC copying PyMC\Approximation.py -> build\lib.win32-2.3\PyMC copying PyMC\KalmanFiltering.py -> build\lib.win32-2.3\PyMC copying PyMC\MCMC.py -> build\lib.win32-2.3\PyMC copying PyMC\Plot.py -> build\lib.win32-2.3\PyMC copying PyMC\Plot_matplot.py -> build\lib.win32-2.3\PyMC copying PyMC\Plot_scipy.py -> build\lib.win32-2.3\PyMC copying PyMC\ReinforcementLearning.py -> build\lib.win32-2.3\PyMC copying PyMC\__init__.py -> build\lib.win32-2.3\PyMC running build_ext No module named msvccompiler in scipy_distutils, trying from distutil= s.. error: Python was built with version 6 of Visual Studio, and extensio= ns need to be built with the same version of the compiler, but it isn't installe= d. =20 D:\Razafindrakoto\PythonEnthought\Lib\site-packages\PyMC-0.2.6> = =20 =20 =20 ______________________________________________________________ AXA CESSIONS =20 Jean-Claude RAZAFINDRAKOTO =20 Re-ARMS Reinsurance - Actuarial and Risk Management Services =20 109 rue La Bo=E9tie 75008 Paris =20 Tel. : +33 1 56 43 78 54 Fax. : +33 1 56 43 78 70 E-mail : jea...@ax... <mailto:mar...@ax...>=20 _______________________________________________________________ =20 |