JakeColtman / bartpy

Bayesian Additive Regression Trees For Python
https://jakecoltman.github.io/bartpy/
MIT License
219 stars 44 forks source link

about an exception #36

Open tairen99 opened 5 years ago

tairen99 commented 5 years ago

Hi, Jake @JakeColtman ,

After pull bartpy, and running it in the pycharm, I got following errors which prevents me to make forcasting (regression) with X is 50 by 10 and y is 50 by 1 The error is:

Starting burn 0%| | 0/200 [00:00<?, ?it/s] Starting burn 0%| | 0/200 [00:00<?, ?it/s] Starting burn 0%| | 0/200 [00:00<?, ?it/s] joblib.externals.loky.process_executor._RemoteTraceback: """ Traceback (most recent call last): File "/home/tairen/.local/lib/python3.6/site-packages/joblib/externals/loky/process_executor.py", line 418, in _process_worker r = call_item() File "/home/tairen/.local/lib/python3.6/site-packages/joblib/externals/loky/process_executor.py", line 272, in call return self.fn(*self.args, *self.kwargs) File "/home/tairen/.local/lib/python3.6/site-packages/joblib/_parallel_backends.py", line 567, in call return self.func(args, **kwargs) File "/home/tairen/.local/lib/python3.6/site-packages/joblib/parallel.py", line 225, in call for func, args, kwargs in self.items] File "/home/tairen/.local/lib/python3.6/site-packages/joblib/parallel.py", line 225, in for func, args, kwargs in self.items] File "/home/tairen/PycharmProjects/bart/samplers/modelsampler.py", line 24, in samples self.step(model) File "/home/tairen/PycharmProjects/bart/samplers/modelsampler.py", line 19, in step step() File "/home/tairen/PycharmProjects/bart/samplers/schedule.py", line 47, in yield lambda: self.tree_sampler.step(model, tree) File "/home/tairen/PycharmProjects/bart/samplers/treemutation/treemutation.py", line 42, in step mutation = self.sample(model, tree) File "/home/tairen/PycharmProjects/bart/samplers/treemutation/treemutation.py", line 36, in sample if np.log(np.random.uniform(0, 1)) < ratio: File "/home/tairen/anaconda3/lib/python3.6/site-packages/pandas/core/generic.py", line 1573, in nonzero .format(self.class.name)) ValueError: The truth value of a Series is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all().

""The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/home/tairen/PycharmProjects/bart/testmain.py", line 13, in model.fit(X, y) # Fit the model File "/home/tairen/PycharmProjects/bart/sklearnmodel.py", line 110, in fit self.extract = Parallel(n_jobs=self.n_jobs)(self.delayed_chains(X, y)) File "/home/tairen/.local/lib/python3.6/site-packages/joblib/parallel.py", line 934, in call self.retrieve() File "/home/tairen/.local/lib/python3.6/site-packages/joblib/parallel.py", line 833, in retrieve self._output.extend(job.get(timeout=self.timeout)) File "/home/tairen/.local/lib/python3.6/site-packages/joblib/_parallel_backends.py", line 521, in wrap_future_result return future.result(timeout=timeout) File "/home/tairen/anaconda3/lib/python3.6/concurrent/futures/_base.py", line 432, in result return self.get_result() File "/home/tairen/anaconda3/lib/python3.6/concurrent/futures/_base.py", line 384, in get_result raise self._exception ValueError: The truth value of a Series is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all().

Can you tell me some hints? Thank you!

JakeColtman commented 5 years ago

Hi, Thanks for trying it out and for raising an issue! As you might have guessed, Bartpy's not particularly battle tested at this point as I've mostly been working on the idea that other people wouldn't be trying to run it.

Would you mind posting the code that you're running so I can try debugging it?