question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Posterior plot errors with boolean array

See original GitHub issue

When passed a boolean array, plot_posterior fails with the following error because np.histogram assumes that subtraction is defined on the array:

TypeError('numpy boolean subtract, the `-` operator, is not supported, use the bitwise_xor, the `^` operator, or the logical_xor function instead.')

This example reproduces the error:

import numpy as np
import arviz as az

data = np.random.choice(a=[False, True], size=(4, 100))
az.plot_posterior(data)

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:9 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
ahartikainencommented, May 13, 2021

We should use bar graph with counts for bool data, not hist.

1reaction
sethaxencommented, May 13, 2021

I’d expect the second, even though the first option is easier.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Bug or meant to be: numpy raises "ValueError: too many ...
When you use that to index t , you pull out only the elements where the boolean array is True leaving you with...
Read more >
bayesplot: Plotting for Bayesian Models
Description Plotting functions for posterior analysis, MCMC diagnostics, prior and posterior predictive checks, and other visualizations.
Read more >
Bayesian Boolean Matrix Factorisation
Boolean matrix factorisation aims to decompose a binary data matrix into an approximate Boolean product of two low rank, binary matrices: one.
Read more >
PPC-distributions • bayesplot - Stan
A boolean defining whether to plot the difference between the observed ECDF and the theoretical expectation for uniform PIT values rather than plotting...
Read more >
lenstronomy.Plots package - Read the Docs
plots a lens model (convergence) and the critical curves and caustics ... error_map – 2d numpy array of size of the image, additional...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found