Skip to content

Move sampler code to nuts-rs and expose new features #105

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

Merged
merged 6 commits into from
Apr 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
709 changes: 571 additions & 138 deletions Cargo.lock

Large diffs are not rendered by default.

10 changes: 6 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,22 +21,24 @@ name = "_lib"
crate-type = ["cdylib"]

[dependencies]
nuts-rs = "0.8.0"
numpy = "0.20.0"
nuts-rs = "0.9.0"
numpy = "0.21.0"
ndarray = "0.15.6"
rand = "0.8.5"
thiserror = "1.0.44"
rand_chacha = "0.3.1"
rayon = "1.9.0"
arrow2 = "0.17.0"
arrow2 = "0.18.0"
anyhow = "1.0.72"
itertools = "0.12.0"
bridgestan = "2.1.2"
rand_distr = "0.4.3"
smallvec = "1.11.0"
upon = { version = "0.8.1", default-features = false, features = [] }
time-humanize = { version = "0.1.3", default-features = false }

[dependencies.pyo3]
version = "0.20.0"
version = "0.21.0"
features = ["extension-module", "anyhow"]

[dev-dependencies]
Expand Down
6 changes: 4 additions & 2 deletions python/nutpie/compile_pymc.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,11 @@ def with_data(self, **updates):
user_data=user_data,
)

def _make_sampler(self, settings, init_mean, chains, cores, seed, callback=None):
def _make_sampler(self, settings, init_mean, cores, template, rate, callback=None):
model = self._make_model(init_mean)
return _lib.PySampler.from_pymc(settings, chains, cores, model, seed, callback)
return _lib.PySampler.from_pymc(
settings, cores, model, template, rate, callback
)

def _make_model(self, init_mean):
expand_fn = _lib.ExpandFunc(
Expand Down
6 changes: 4 additions & 2 deletions python/nutpie/compile_stan.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,11 @@ def _make_model(self, init_mean):
return self.with_data().model
return self.model

def _make_sampler(self, settings, init_mean, chains, cores, seed, callback=None):
def _make_sampler(self, settings, init_mean, cores, template, rate, callback=None):
model = self._make_model(init_mean)
return _lib.PySampler.from_stan(settings, chains, cores, model, seed, callback)
return _lib.PySampler.from_stan(
settings, cores, model, template, rate, callback
)

@property
def n_dim(self):
Expand Down
Loading