Closed sreedat closed 3 years ago
Hi @sreedat,
I'm sorry you're experiencing this unfortunate problem. I see that you've also opened https://github.com/pymc-devs/pymc3/issues/4908, where you tell that it works for some models but it fails for others. Could you confirm if Bambi works with a simple linear regression (without hierarchies)?
I'm not familiar with the problem you're having, but as far as I can understand, it seems to be a problem with Theano or PyMC3.
@tomicapretto thanks for taking the time to get back to my post. Yes what you noted is correct. I could test Pymc3 and Bambi with simple linear regression models without levels successfully. If I attempt the multi-level / hierarchical approaches in Pymc3 or in Bambi I get the above error. So far I have removed the environment and reinstalled Anaconda from scratch and tried to get bambi to work on the multilevel models without success. This error persists.
Maybe this one https://github.com/pymc-devs/pymc3/issues/4749 helps?
Thanks @tomicapretto for the link. That was the first resource I had examined thoroughly to see how the errors can be corrected. I followed the specific installation instructions and that helped me run the Linear Regression and Stock Market examples provided in the “Pymc3 Getting Started” page. I was using the example code verbatim. The error occurs again in the third example “Coal Mine Disasters” model. My code shows that Pymc3 is correctly assigning NUTS for Continuous variables and Metropolis for the Discrete (the Count of Coal mine accidents) but yet the error still crops up. I have removed the environment and reinstalled per the specifications given in the link you shared. The error does not go away. In addition, I cannot run the example 3 and I cannot run the Pigs Growth Curves example from the Bambi documentation.
I have tested that model(Pigs Growth Curves) now on two other machines with fresh Anaconda3 installs (Windows 8.1 with Anaconda3-64 bit & Ubuntu 20.04 with Anaconda3-64bit). I get the same error. As a non-programmer, I'm lost
What really stumps me is that examples 1 & 2 run and three fails for Pymc3, and basic multi-level models model fails for Bambi.
Thanks again for your help - Sree
I'm so sorry this is so frustrating.
What if you install everything via pip in the Ubuntu system?
Also, maybe Google Colab is a good alternative to your local computer while we try to find a solution for this problem...
Edit
I'm mentioning pip
because that's how I usually install Bambi in my computer. I just have a conda environment where I do something like
conda create --name myenv
conda activate myenv
conda install pip
pip install bambi
and everything works fine (Ubuntu 20.04)
@tomicapretto thanks for getting back. Across all three machines I have used pip
to install both pymc3
and bambi
. I just got my hands on a completely new laptop with no installs ever and has a dual Windows and Ubunto boot. I will install as advised and see if it works.
Thanks for taking the time to help. I love using brms
in the R eco-system and I found that bambi
is a wonderful analog on the Python side. Thanks for doing what you all do in creating such tools and helping the rest of us.
Sree
@tomicapretto I could not get Bambi to work on the new Windows 10 fresh install for the Pigs Growth Curve example. It worked in the new Ubuntu on a fresh install and then I got the same example model on Bambi working on my personal laptop with Windows 8.1 as well as on Ubuntu 20.04 LTS on this Windows 8.1 laptop. The good news is "bambi" is working, but why it is failing on Windows 10 laptops, I cannot figure out.
Thanks again for your help. - Sree
@sreedat thanks for reporting all the work you're doing, I'm sure it can be valuable for others going through similar issues. I'm happy it's working now on Ubuntu.
For the Windows problem, I would wait until PyMC3 launches its v4. That version is going to use Aesara, instead of the unmaintained Theano.
@tomicapretto thanks for the additional information regarding the version with Aesara. As one last attempt to get it to work on Windows 10, I have created an environment.yml
file from the Windows 8.1 install where it is working and will test with Windows 10.
I have found that when installing pymc3=3.11.2
or bambi=0.6.0
, matplotlib=3.4.3
is unable to be compiled. It is breaking the entire installation process. I manually forced on Windows 8.1 to install the previous matplotlib=3.4.2
. This compiles well. The issue is cropping on Windows 10 as well where '``matplotlib=3.4.3``` fails compilation.
I now have a good working environment for pymc3=3.11.2
on WIndows 10 and Windows 8.1; I have a good working pymc3=3.11.2
and bambi=0.5.0
together on Windows 8.1. I will see if the approach with the environment file will do the trick for bambi on Windows 10. If I get them to work, I will post those environment files for others to try and use.
Thanks again - Sree
@tomicapretto My latest attempt at getting bambi
to work on Windows 10 ends up with the same error Invalid register ...
Here I was testing the very basic linear regression example (not a multi-level model)
import bambi as bmb
import numpy as np
import pandas as pd
data = pd.DataFrame({
"y": np.random.normal(size=50),
"g": np.random.choice(["Yes", "No"], size=50),
"x1": np.random.normal(size=50),
"x2": np.random.normal(size=50)
})
model = bmb.Model("y ~ x1 + x2", data)
fitted = model.fit()
Here is the error (again with Theano of course - I actually tried to use Pymc3 v4 and bambi
could not work with Aesara
)
You can find the C code in this temporary file: C:\Users\SREEDATTA\AppData\Local\Temp\theano_compilation_error_umr4pu9y
---------------------------------------------------------------------------
Exception Traceback (most recent call last)
C:\Users\SREEDATTA\AppData\Local\Temp/ipykernel_5520/1973983237.py in <module>
1 model = bmb.Model("y ~ x1 + x2", data)
----> 2 fitted = model.fit()
C:\ProgramData\Anaconda3\envs\bampm3\lib\site-packages\bambi\models.py in fit(self, omit_offsets, **kwargs)
220 )
221
--> 222 return self.backend.run(omit_offsets=omit_offsets, **kwargs)
223
224 def build(self):
C:\ProgramData\Anaconda3\envs\bampm3\lib\site-packages\bambi\backends\pymc.py in run(self, start, method, init, n_init, omit_offsets, **kwargs)
212 n_init=n_init,
213 return_inferencedata=True,
--> 214 **kwargs,
215 )
216
C:\ProgramData\Anaconda3\envs\bampm3\lib\site-packages\pymc3\sampling.py in sample(draws, step, init, n_init, start, trace, chain_idx, chains, cores, tune, progressbar, model, random_seed, discard_tuned_samples, compute_convergence_checks, callback, jitter_max_retries, return_inferencedata, idata_kwargs, mp_ctx, pickle_backend, **kwargs)
502 progressbar=progressbar,
503 jitter_max_retries=jitter_max_retries,
--> 504 **kwargs,
505 )
506 if start is None:
C:\ProgramData\Anaconda3\envs\bampm3\lib\site-packages\pymc3\sampling.py in init_nuts(init, chains, n_init, model, random_seed, progressbar, jitter_max_retries, **kwargs)
2185 raise ValueError(f"Unknown initializer: {init}.")
2186
-> 2187 step = pm.NUTS(potential=potential, model=model, **kwargs)
2188
2189 return start, step
C:\ProgramData\Anaconda3\envs\bampm3\lib\site-packages\pymc3\step_methods\hmc\nuts.py in __init__(self, vars, max_treedepth, early_max_treedepth, **kwargs)
166 `pm.sample` to the desired number of tuning steps.
167 """
--> 168 super().__init__(vars, **kwargs)
169
170 self.max_treedepth = max_treedepth
C:\ProgramData\Anaconda3\envs\bampm3\lib\site-packages\pymc3\step_methods\hmc\base_hmc.py in __init__(self, vars, scaling, step_scale, is_cov, model, blocked, potential, dtype, Emax, target_accept, gamma, k, t0, adapt_step_size, step_rand, **theano_kwargs)
86 vars = inputvars(vars)
87
---> 88 super().__init__(vars, blocked=blocked, model=model, dtype=dtype, **theano_kwargs)
89
90 self.adapt_step_size = adapt_step_size
C:\ProgramData\Anaconda3\envs\bampm3\lib\site-packages\pymc3\step_methods\arraystep.py in __init__(self, vars, model, blocked, dtype, logp_dlogp_func, **theano_kwargs)
252
253 if logp_dlogp_func is None:
--> 254 func = model.logp_dlogp_function(vars, dtype=dtype, **theano_kwargs)
255 else:
256 func = logp_dlogp_func
C:\ProgramData\Anaconda3\envs\bampm3\lib\site-packages\pymc3\model.py in logp_dlogp_function(self, grad_vars, tempered, **kwargs)
1002 varnames = [var.name for var in grad_vars]
1003 extra_vars = [var for var in self.free_RVs if var.name not in varnames]
-> 1004 return ValueGradFunction(costs, grad_vars, extra_vars, **kwargs)
1005
1006 @property
C:\ProgramData\Anaconda3\envs\bampm3\lib\site-packages\pymc3\model.py in __init__(self, costs, grad_vars, extra_vars, dtype, casting, compute_grads, **kwargs)
689
690 if compute_grads:
--> 691 grad = tt.grad(self._cost_joined, self._vars_joined)
692 grad.name = "__grad"
693 outputs = [self._cost_joined, grad]
C:\ProgramData\Anaconda3\envs\bampm3\lib\site-packages\theano\gradient.py in grad(cost, wrt, consider_constant, disconnected_inputs, add_names, known_grads, return_disconnected, null_gradients)
637 assert g.type.dtype in theano.tensor.float_dtypes
638
--> 639 rval = _populate_grad_dict(var_to_app_to_idx, grad_dict, wrt, cost_name)
640
641 for i in range(len(rval)):
C:\ProgramData\Anaconda3\envs\bampm3\lib\site-packages\theano\gradient.py in _populate_grad_dict(var_to_app_to_idx, grad_dict, wrt, cost_name)
1438 return grad_dict[var]
1439
-> 1440 rval = [access_grad_cache(elem) for elem in wrt]
1441
1442 return rval
C:\ProgramData\Anaconda3\envs\bampm3\lib\site-packages\theano\gradient.py in <listcomp>(.0)
1438 return grad_dict[var]
1439
-> 1440 rval = [access_grad_cache(elem) for elem in wrt]
1441
1442 return rval
C:\ProgramData\Anaconda3\envs\bampm3\lib\site-packages\theano\gradient.py in access_grad_cache(var)
1391 for idx in node_to_idx[node]:
1392
-> 1393 term = access_term_cache(node)[idx]
1394
1395 if not isinstance(term, Variable):
C:\ProgramData\Anaconda3\envs\bampm3\lib\site-packages\theano\gradient.py in access_term_cache(node)
1059 inputs = node.inputs
1060
-> 1061 output_grads = [access_grad_cache(var) for var in node.outputs]
1062
1063 # list of bools indicating if each output is connected to the cost
C:\ProgramData\Anaconda3\envs\bampm3\lib\site-packages\theano\gradient.py in <listcomp>(.0)
1059 inputs = node.inputs
1060
-> 1061 output_grads = [access_grad_cache(var) for var in node.outputs]
1062
1063 # list of bools indicating if each output is connected to the cost
C:\ProgramData\Anaconda3\envs\bampm3\lib\site-packages\theano\gradient.py in access_grad_cache(var)
1391 for idx in node_to_idx[node]:
1392
-> 1393 term = access_term_cache(node)[idx]
1394
1395 if not isinstance(term, Variable):
C:\ProgramData\Anaconda3\envs\bampm3\lib\site-packages\theano\gradient.py in access_term_cache(node)
1059 inputs = node.inputs
1060
-> 1061 output_grads = [access_grad_cache(var) for var in node.outputs]
1062
1063 # list of bools indicating if each output is connected to the cost
C:\ProgramData\Anaconda3\envs\bampm3\lib\site-packages\theano\gradient.py in <listcomp>(.0)
1059 inputs = node.inputs
1060
-> 1061 output_grads = [access_grad_cache(var) for var in node.outputs]
1062
1063 # list of bools indicating if each output is connected to the cost
C:\ProgramData\Anaconda3\envs\bampm3\lib\site-packages\theano\gradient.py in access_grad_cache(var)
1391 for idx in node_to_idx[node]:
1392
-> 1393 term = access_term_cache(node)[idx]
1394
1395 if not isinstance(term, Variable):
C:\ProgramData\Anaconda3\envs\bampm3\lib\site-packages\theano\gradient.py in access_term_cache(node)
1059 inputs = node.inputs
1060
-> 1061 output_grads = [access_grad_cache(var) for var in node.outputs]
1062
1063 # list of bools indicating if each output is connected to the cost
C:\ProgramData\Anaconda3\envs\bampm3\lib\site-packages\theano\gradient.py in <listcomp>(.0)
1059 inputs = node.inputs
1060
-> 1061 output_grads = [access_grad_cache(var) for var in node.outputs]
1062
1063 # list of bools indicating if each output is connected to the cost
C:\ProgramData\Anaconda3\envs\bampm3\lib\site-packages\theano\gradient.py in access_grad_cache(var)
1391 for idx in node_to_idx[node]:
1392
-> 1393 term = access_term_cache(node)[idx]
1394
1395 if not isinstance(term, Variable):
C:\ProgramData\Anaconda3\envs\bampm3\lib\site-packages\theano\gradient.py in access_term_cache(node)
1218 )
1219
-> 1220 input_grads = node.op.L_op(inputs, node.outputs, new_output_grads)
1221
1222 if input_grads is None:
C:\ProgramData\Anaconda3\envs\bampm3\lib\site-packages\theano\tensor\elemwise.py in L_op(self, inputs, outs, ograds)
562
563 # compute grad with respect to broadcasted input
--> 564 rval = self._bgrad(inputs, outs, ograds)
565
566 # TODO: make sure that zeros are clearly identifiable
C:\ProgramData\Anaconda3\envs\bampm3\lib\site-packages\theano\tensor\elemwise.py in _bgrad(self, inputs, outputs, ograds)
666 ret.append(None)
667 continue
--> 668 ret.append(transform(scalar_igrad))
669
670 return ret
C:\ProgramData\Anaconda3\envs\bampm3\lib\site-packages\theano\tensor\elemwise.py in transform(r)
657 return DimShuffle((), ["x"] * nd)(res)
658
--> 659 new_r = Elemwise(node.op, {})(*[transform(ipt) for ipt in node.inputs])
660 return new_r
661
C:\ProgramData\Anaconda3\envs\bampm3\lib\site-packages\theano\tensor\elemwise.py in <listcomp>(.0)
657 return DimShuffle((), ["x"] * nd)(res)
658
--> 659 new_r = Elemwise(node.op, {})(*[transform(ipt) for ipt in node.inputs])
660 return new_r
661
C:\ProgramData\Anaconda3\envs\bampm3\lib\site-packages\theano\tensor\elemwise.py in transform(r)
657 return DimShuffle((), ["x"] * nd)(res)
658
--> 659 new_r = Elemwise(node.op, {})(*[transform(ipt) for ipt in node.inputs])
660 return new_r
661
C:\ProgramData\Anaconda3\envs\bampm3\lib\site-packages\theano\graph\op.py in __call__(self, *inputs, **kwargs)
251
252 if config.compute_test_value != "off":
--> 253 compute_test_value(node)
254
255 if self.default_output is not None:
C:\ProgramData\Anaconda3\envs\bampm3\lib\site-packages\theano\graph\op.py in compute_test_value(node)
124
125 # Create a thunk that performs the computation
--> 126 thunk = node.op.make_thunk(node, storage_map, compute_map, no_recycling=[])
127 thunk.inputs = [storage_map[v] for v in node.inputs]
128 thunk.outputs = [storage_map[v] for v in node.outputs]
C:\ProgramData\Anaconda3\envs\bampm3\lib\site-packages\theano\graph\op.py in make_thunk(self, node, storage_map, compute_map, no_recycling, impl)
632 )
633 try:
--> 634 return self.make_c_thunk(node, storage_map, compute_map, no_recycling)
635 except (NotImplementedError, MethodNotDefined):
636 # We requested the c code, so don't catch the error.
C:\ProgramData\Anaconda3\envs\bampm3\lib\site-packages\theano\graph\op.py in make_c_thunk(self, node, storage_map, compute_map, no_recycling)
599 raise NotImplementedError("float16")
600 outputs = cl.make_thunk(
--> 601 input_storage=node_input_storage, output_storage=node_output_storage
602 )
603 thunk, node_input_filters, node_output_filters = outputs
C:\ProgramData\Anaconda3\envs\bampm3\lib\site-packages\theano\link\c\basic.py in make_thunk(self, input_storage, output_storage, storage_map)
1202 init_tasks, tasks = self.get_init_tasks()
1203 cthunk, module, in_storage, out_storage, error_storage = self.__compile__(
-> 1204 input_storage, output_storage, storage_map
1205 )
1206
C:\ProgramData\Anaconda3\envs\bampm3\lib\site-packages\theano\link\c\basic.py in __compile__(self, input_storage, output_storage, storage_map)
1140 input_storage,
1141 output_storage,
-> 1142 storage_map,
1143 )
1144 return (
C:\ProgramData\Anaconda3\envs\bampm3\lib\site-packages\theano\link\c\basic.py in cthunk_factory(self, error_storage, in_storage, out_storage, storage_map)
1632 for node in self.node_order:
1633 node.op.prepare_node(node, storage_map, None, "c")
-> 1634 module = get_module_cache().module_from_key(key=key, lnk=self)
1635
1636 vars = self.inputs + self.outputs + self.orphans
C:\ProgramData\Anaconda3\envs\bampm3\lib\site-packages\theano\link\c\cmodule.py in module_from_key(self, key, lnk)
1189 try:
1190 location = dlimport_workdir(self.dirname)
-> 1191 module = lnk.compile_cmodule(location)
1192 name = module.__file__
1193 assert name.startswith(location)
C:\ProgramData\Anaconda3\envs\bampm3\lib\site-packages\theano\link\c\basic.py in compile_cmodule(self, location)
1548 lib_dirs=self.lib_dirs(),
1549 libs=libs,
-> 1550 preargs=preargs,
1551 )
1552 except Exception as e:
C:\ProgramData\Anaconda3\envs\bampm3\lib\site-packages\theano\link\c\cmodule.py in compile_str(module_name, src_code, location, include_dirs, lib_dirs, libs, preargs, py_module, hide_symbols)
2545 compile_stderr = compile_stderr.replace("\n", ". ")
2546 raise Exception(
-> 2547 f"Compilation failed (return status={status}): {compile_stderr}"
2548 )
2549 elif config.cmodule__compilation_warning and compile_stderr:
Exception: ('Compilation failed (return status=1): C:\\Users\\SREEDATTA\\AppData\\Local\\Temp\\ccwFHUra.s: Assembler messages:\r. C:\\Users\\SREEDATTA\\AppData\\Local\\Temp\\ccwFHUra.s:365: Error: invalid register for .seh_savexmm\r. C:\\Users\\SREEDATTA\\AppData\\Local\\Temp\\ccwFHUra.s:367: Error: invalid register for .seh_savexmm\r. C:\\Users\\SREEDATTA\\AppData\\Local\\Temp\\ccwFHUra.s:369: Error: invalid register for .seh_savexmm\r. C:\\Users\\SREEDATTA\\AppData\\Local\\Temp\\ccwFHUra.s:371: Error: invalid register for .seh_savexmm\r. C:\\Users\\SREEDATTA\\AppData\\Local\\Temp\\ccwFHUra.s:373: Error: invalid register for .seh_savexmm\r. C:\\Users\\SREEDATTA\\AppData\\Local\\Temp\\ccwFHUra.s:375: Error: invalid register for .seh_savexmm\r. C:\\Users\\SREEDATTA\\AppData\\Local\\Temp\\ccwFHUra.s:377: Error: invalid register for .seh_savexmm\r. C:\\Users\\SREEDATTA\\AppData\\Local\\Temp\\ccwFHUra.s:379: Error: invalid register for .seh_savexmm\r. C:\\Users\\SREEDATTA\\AppData\\Local\\Temp\\ccwFHUra.s:381: Error: invalid register for .seh_savexmm\r. C:\\Users\\SREEDATTA\\AppData\\Local\\Temp\\ccwFHUra.s:383: Error: invalid register for .seh_savexmm\r. C:\\Users\\SREEDATTA\\AppData\\Local\\Temp\\ccwFHUra.s:385: Error: invalid register for .seh_savexmm\r. C:\\Users\\SREEDATTA\\AppData\\Local\\Temp\\ccwFHUra.s:387: Error: invalid register for .seh_savexmm\r. C:\\Users\\SREEDATTA\\AppData\\Local\\Temp\\ccwFHUra.s:389: Error: invalid register for .seh_savexmm\r. C:\\Users\\SREEDATTA\\AppData\\Local\\Temp\\ccwFHUra.s:391: Error: invalid register for .seh_savexmm\r. C:\\Users\\SREEDATTA\\AppData\\Local\\Temp\\ccwFHUra.s:393: Error: invalid register for .seh_savexmm\r. C:\\Users\\SREEDATTA\\AppData\\Local\\Temp\\ccwFHUra.s:395: Error: invalid register for .seh_savexmm\r. ', 'FunctionGraph(Elemwise{mul}(<TensorType(float64, (True,))>, <TensorType(int8, (True,))>))')
My adventures will continue :-) on Windows 10. It so interesting that the set-up that works with Theano-pymc on Windows 8.1 does not work with Windows 10.
@tomicapretto I have finally solved the issue I was facing with Bambi compilation and the theano
errors being generated with some guidance from @michaelosthege (one of the Pymc3 developers). It turned out that on Windows 10, my Anaconda libraries (Bambi and Pymc3) were using my mingw
compilers from RTools (I use R and Anaconda for my Stats and Data Science work). I needed to set up my User PATH variables so that Pymc3 was accessing the m2w64 toolchain
and its' mingw compilers.
Now what is interesting is that I did not explicitly set up my User PATH on Windows 8.1 but Pymc3 and Bambi were working correctly. I still cannot figure that out. I know the entire file structure of Linux is very different from Windows and I did not need to set up anything post install for the correct compilers to be used.
I have volunteered to develop a post-installation troubleshooting guide for Pymc3 as a way to say thanks and help other users such as I. Let me know if there is something similar I can post here that would help other users. I truly believe that bambi
is a wonderful tool for non-programmers and will help increase the utilization of Pymc3 among us.
If I can help with any documentation or a guide, I would love to. Most people when installing and using bambi
may not realize where these errors are really originating from just as myself if they did not test pymc3
previously. Please let me know.
@tomicapretto My models are working well now via bambi
. I have one following question:
How do I specify / change
Hi @sreedat
It's so happy you have found the solution!
I've been thinking I could set up a section on our documentation webpage to show these kind of gotchas. I'll come back tomorrow with more precise guidelines.
About the second message, you can pass all those keywords to the .fit()
method, e.g. model.fit(target_accept=0.9, max_treedepth=20). Basically, anything you would pass to regular
pm.sample()can be passed to
model.fit()` in Bambi
@tomicapretto thanks for your patience and for taking the time to help. You have been such a huge help and bambi
is what I tell all of my students and colleagues to use along with pymc3
as a majority of them are non-programmers and for them even pymc3
style specification is often a barrier to adoption.
Let me know if I can help with the documentation. Since I'm not a programmer, I cannot help in the development. I love what bambi
does for non-programmers such as I, making pymc3
that much more accessible. I would like to help at least with the documentation portion.
I would like to help with documentation about post-installation testing of bambi
and in adding examples with information concerning how to specify things such as target_accept & max_treedepth
. As a end user, I often find very few models really work with the default target_accept=0.8
. From working with rstan
and brms
, I know that target_accept
is the first control parameter, I look to change, when divergences occur
.
Thank you once again for your dedication, hard work, and passion to bring a tool such as bambi
to the pymc3
user community. I have not done any work on GitHub and so I'm unfamiliar with the "how-to" of developing examples or documentation. I would love to get involved and help.
Sree
@sreedat Thanks for offering to help with the documentation. Writing good documentation can be a hard task and getting help from the end-users always makes the process much easier and the result much richer.
I think a good strategy could be to have a FAQ section to centralize common issues, like installation issues or how to pass arguments to fit()
. We could also have some of that content mentioned directly in the notebook examples. This is one case were redundancy is a good idea.
Additionally, we could have notebooks explaining in more details things like what divergences are, for these kind of pages we could coordinate with ArviZ (and also PyMC3) to have more centralized resources. ArviZ has a subproject of writing documentation explaining things such as convergence diagnostics. @OriolAbril, @canyon289, @roshnaeem
@aloctavodia thanks for getting back. I would love to contribute with Installation to start with since I think for the new inexperienced users, getting a working installation of Pymc3 and Bambi on Windows will be the biggest hurdle to overcome. I sincerely believe that both Pymc3 and Bambi represent powerful and amazing tools in the Bayesian space and would love for more non-programmers and applied researchers to begin using these tools. So many of us are using both R and Python for Bayesian modeling and both of these tools and platforms work and function somewhat differently on Windows compared to Linux/Unix/MacOs. In my recent exercise, I could clearly see how I got stuck just at the installation stage, even though I have worked with R and RTools for a long time.
Your suggestion for passing arguments to fit()
and explaining what the divergences are
and how they are addressed by changing values of target_accept
or convergence diagnostics
in Notebooks would be the perfect way to illustrate to new users the use of Pymc3, Bambi, and Arviz. Additionally examples that illustrate the use of ADVI vs MH vs HMC-NUTS would also be very helpful. In the R eco-system I work with non-Bayesian packages nlme & lme4
to understand hierarchical models first before embarking on Bayesian using MH / Gibbs / HMC-NUTS. I would like to do the same for Bambi where we begin with statsmodels
and then build on those concepts into Pymc3 and Bambi applications.
I will reach out to you with a installation guide first. I had posted an initial guide for installing Pymc3 (on the Github\Pymc3) under Issues as advised by @michaelosthege. If you could take a look at that and give me feedback would be great. I can easily add the piece of installing Bambi and testing it.
I have worked for a longtime in marketing research and analytics and can bring a number of real world data sets, that I have collected personally as a consultant, when creating these examples. I look forward to helping in any way I can to these wonderful projects.
@sreedat I'm adding a FAQ page to our docs. If you think you can create the PR, go ahead. Otherwise, leave your installation guide here and I will add it to our docs.
Bambi docs are built with sphinx, which uses the Restructured Text format. This cheatsheet may be helpful.
Some guidelines if you want to create the PR:
pip install -r requirements-dev.txt
with the console open at the root of the project.docs/faq.rst
and write your content there. There's a basic skeleton, but please feel free to ask if you need to check something.sphinx-build docs docs/_build
.docs/_build/faq.html
to see results.Finally, it would be awesome if you could contribute real world datasets. I want to add some end-to-end examples with real data to our gallery and having yours would be great. You could simply open a PR where we can discuss how to add your data to the library, but also feel free to send me an email if you want to discuss anything before making data public.
Thanks @tomicapretto for the notes above. What is a PR? I will begin by setting up what is needed. What were you referring to when you said "the root of the project"? Do I need to git clone the bambi
repository locally to get started? These questions are likely basic, but will be helpful for me to start. I will also examine the cheat sheet. I would love for bambi
to be illustrated with real world data sets.
@sreedat, PR means Pull Request. It is an instance where a contributor tells the maintainers of a project to review code that he/she wants to merge into the project.
We have a CONTRIBUTING file, but these are the steps you need:
git clone git@github.com:sreedat/bambi.git
cd bambi
git remote add upstream git@github.com:bambinos/bambi.git
The first line clones the repo, the seconds moves you to the root of the bambi project, and the third line tells Git that the repository in bambinos/bambi (the base) is a remote (see here for info on the upstream).
feature
branch to hold your development changes. If the name of the branch is new-docs
you can do:git checkout -b new-docs
Always use a feature
branch. It's good practice to never routinely work on the main
branch of any repository.
requirements.txt
, and libraries used for development are in requirements-dev.txt
. To set up a development environment, you may run:pip install -r requirements.txt
pip install -r requirements-dev.txt
docs/faq.rst
. Then, add changed files using git add
and then git commit
files:git add docs/faq.rst
git commit -m "This message describes the changes made"
git push -u origin new-docs
@tomicapretto thank you for a detailed step by step process description. I will get familiar with this process in a couple of days. Beginning this Friday, I will start sharing content. I will reach out if I get stuck or have a question.
Sree
I'm working on a laptop with Windows 10 and using Anaconda 64-bit. I have created an environment for working with Pymc3 and bambi. I have been able to test Pymc3 and it is working for an Hierarchical Linear Regression model. For bambi I was testing the example described at this link (growth curves of Pigs example) [https://bambinos.github.io/bambi/master/notebooks/multi-level_regression.html]. I run into an error I had not seen with bambi before (actually from the output this looks like it is occurring at Theano, but I'm not a programmer or a developer).
Here is my environment and the complete traceback of the error
Model I tried to run is:
And the error I get is:
Can one of you help?
Sree