Skip to content

Commit 2b81f4e

Browse files
thomasjpfanricardoV94
authored andcommitted
MNT Removes pandas dependence in sampling_jax
1 parent e165cb1 commit 2b81f4e

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

pymc/sampling_jax.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,12 @@
1010
xla_flags = re.sub(r"--xla_force_host_platform_device_count=.+\s", "", xla_flags).split()
1111
os.environ["XLA_FLAGS"] = " ".join([f"--xla_force_host_platform_device_count={100}"] + xla_flags)
1212

13+
from datetime import datetime
14+
1315
import aesara.tensor as at
1416
import arviz as az
1517
import jax
1618
import numpy as np
17-
import pandas as pd
1819

1920
from aeppl.logprob import CheckParameterValue
2021
from aesara.compile import SharedVariable, Supervisor, mode
@@ -174,7 +175,7 @@ def sample_numpyro_nuts(
174175
else:
175176
dims = {}
176177

177-
tic1 = pd.Timestamp.now()
178+
tic1 = datetime.now()
178179
print("Compiling...", file=sys.stdout)
179180

180181
rv_names = [rv.name for rv in model.value_vars]
@@ -202,7 +203,7 @@ def sample_numpyro_nuts(
202203
progress_bar=progress_bar,
203204
)
204205

205-
tic2 = pd.Timestamp.now()
206+
tic2 = datetime.now()
206207
print("Compilation time = ", tic2 - tic1, file=sys.stdout)
207208

208209
print("Sampling...", file=sys.stdout)
@@ -231,7 +232,7 @@ def sample_numpyro_nuts(
231232

232233
raw_mcmc_samples = pmap_numpyro.get_samples(group_by_chain=True)
233234

234-
tic3 = pd.Timestamp.now()
235+
tic3 = datetime.now()
235236
print("Sampling time = ", tic3 - tic2, file=sys.stdout)
236237

237238
print("Transforming variables...", file=sys.stdout)
@@ -241,7 +242,7 @@ def sample_numpyro_nuts(
241242
result = jax.vmap(jax.vmap(jax_fn))(*raw_mcmc_samples)[0]
242243
mcmc_samples[v.name] = result
243244

244-
tic4 = pd.Timestamp.now()
245+
tic4 = datetime.now()
245246
print("Transformation time = ", tic4 - tic3, file=sys.stdout)
246247

247248
if idata_kwargs is None:

0 commit comments

Comments
 (0)