Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multivariate T #26

Merged
merged 12 commits into from
Feb 2, 2021
Merged

Multivariate T #26

merged 12 commits into from
Feb 2, 2021

Conversation

multimeric
Copy link
Contributor

@multimeric multimeric commented Jan 27, 2021

  • Introduces a pluggable prior/posterior config for multivariate Gaussian data, with sensible defaults. Note that this only works for scipy > 1.6.0, where they introduced the multivariate t PDF. The library will remind you to upgrade if you have an old version.
  • Adds a test for this new configuration, as well as for the univariate one
  • Adds a "dev" and "multivariate" setup extra, meaning that you can pip install bayesian_changepoint_detection[dev] for development work (currently this installs pytest), or pip install bayesian_changepoint_detection[multivariate] (enforces that you have a new enough scipy version for this new feature)

setup.py Outdated
packages = ['bayesian_changepoint_detection'],
requires=['scipy', 'numpy']
)
setup(
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, thanks!

test.py Outdated
partial(offline.const_prior, l=(len(dataset) + 1)),
online.MultivariateT(10)
)
# TODO: assertion
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One possibility: just do a snapshot test here

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure what you mean by this. Still, I've added an assertion based on #18 (comment)

@multimeric multimeric marked this pull request as ready for review January 29, 2021 00:45
@multimeric
Copy link
Contributor Author

Oops, a colleague just pointed out a huge flaw in my implementation. I'm putting this back to draft while I fix it.

@multimeric multimeric marked this pull request as draft February 1, 2021 06:56
test.py Show resolved Hide resolved
@multimeric
Copy link
Contributor Author

Well, I don't love the accuracy of it, but does seem to output a meaningful signal for multiple changepoints. I also copied a plot function used in the notebook into the module for others' use. Here is an example calculated using the multivariate test data:
image

@multimeric multimeric marked this pull request as ready for review February 2, 2021 03:24
dof = dims + 1
# The default mean is all 0s
if mu is None:
mu = [0]*dims
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nitpick: spaces around *

@hildensia hildensia merged commit 2ba96fd into hildensia:master Feb 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants