hoppMCMC 2.2.0__tar.gz → 2.2.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {hoppmcmc-2.2.0 → hoppmcmc-2.2.1}/NEWS.txt +1 -2
- {hoppmcmc-2.2.0/src/hoppMCMC.egg-info → hoppmcmc-2.2.1}/PKG-INFO +1 -1
- {hoppmcmc-2.2.0 → hoppmcmc-2.2.1}/pyproject.toml +1 -1
- {hoppmcmc-2.2.0 → hoppmcmc-2.2.1}/setup.cfg +1 -1
- {hoppmcmc-2.2.0 → hoppmcmc-2.2.1}/src/hoppMCMC/__init__.py +1 -1
- {hoppmcmc-2.2.0 → hoppmcmc-2.2.1/src/hoppMCMC.egg-info}/PKG-INFO +1 -1
- {hoppmcmc-2.2.0 → hoppmcmc-2.2.1}/src/inferFun/__init__.py +46 -0
- {hoppmcmc-2.2.0 → hoppmcmc-2.2.1}/LICENSE +0 -0
- {hoppmcmc-2.2.0 → hoppmcmc-2.2.1}/MANIFEST.in +0 -0
- {hoppmcmc-2.2.0 → hoppmcmc-2.2.1}/README.txt +0 -0
- {hoppmcmc-2.2.0 → hoppmcmc-2.2.1}/setup.py +0 -0
- {hoppmcmc-2.2.0 → hoppmcmc-2.2.1}/src/hoppMCMC/doc/hoppMCMC_manual.pdf +0 -0
- {hoppmcmc-2.2.0 → hoppmcmc-2.2.1}/src/hoppMCMC/examples/example1.py +0 -0
- {hoppmcmc-2.2.0 → hoppmcmc-2.2.1}/src/hoppMCMC/examples/example2.py +0 -0
- {hoppmcmc-2.2.0 → hoppmcmc-2.2.1}/src/hoppMCMC/examples/example3.py +0 -0
- {hoppmcmc-2.2.0 → hoppmcmc-2.2.1}/src/hoppMCMC/examples/example4.py +0 -0
- {hoppmcmc-2.2.0 → hoppmcmc-2.2.1}/src/hoppMCMC/examples/example5.py +0 -0
- {hoppmcmc-2.2.0 → hoppmcmc-2.2.1}/src/hoppMCMC.egg-info/SOURCES.txt +0 -0
- {hoppmcmc-2.2.0 → hoppmcmc-2.2.1}/src/hoppMCMC.egg-info/dependency_links.txt +0 -0
- {hoppmcmc-2.2.0 → hoppmcmc-2.2.1}/src/hoppMCMC.egg-info/not-zip-safe +0 -0
- {hoppmcmc-2.2.0 → hoppmcmc-2.2.1}/src/hoppMCMC.egg-info/requires.txt +0 -0
- {hoppmcmc-2.2.0 → hoppmcmc-2.2.1}/src/hoppMCMC.egg-info/top_level.txt +0 -0
- {hoppmcmc-2.2.0 → hoppmcmc-2.2.1}/src/myMPI/__init__.py +0 -0
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "hoppMCMC"
|
|
7
|
-
version = "2.2.
|
|
7
|
+
version = "2.2.1"
|
|
8
8
|
description = "An adaptive basin-hopping Markov-chain Monte Carlo algorithm for Bayesian optimisation"
|
|
9
9
|
authors = [{ name = "Kamil Erguler", email = "kerguler@gmail.com" }]
|
|
10
10
|
license = { text = "GPLv3" }
|
|
@@ -488,6 +488,52 @@ class inferABCModels:
|
|
|
488
488
|
# Add small jitter to avoid singular covariance problems.
|
|
489
489
|
kernel = kernel + numpy.eye(kernel.shape[0]) * self.jitter
|
|
490
490
|
|
|
491
|
+
eigvals, eigvecs = numpy.linalg.eigh(kernel)
|
|
492
|
+
if numpy.any(eigvals <= 0):
|
|
493
|
+
raise ValueError(
|
|
494
|
+
f"Kernel is not positive definite for model {model_id} "
|
|
495
|
+
f"({self.model_names[model_id]}), even after jitter. "
|
|
496
|
+
f"Eigenvalues={eigvals}\nKernel:\n{kernel}"
|
|
497
|
+
)
|
|
498
|
+
|
|
499
|
+
condition_number = eigvals[-1] / eigvals[0]
|
|
500
|
+
if condition_number > 1e10 and self.verbose:
|
|
501
|
+
smallest = numpy.argmin(eigvals)
|
|
502
|
+
bad_direction = eigvecs[:, smallest]
|
|
503
|
+
culprit_order = numpy.argsort(numpy.abs(bad_direction))[::-1]
|
|
504
|
+
print(
|
|
505
|
+
f"Warning: near-singular kernel for model {model_id} "
|
|
506
|
+
f"({self.model_names[model_id]}). "
|
|
507
|
+
f"condition_number={condition_number:g}, "
|
|
508
|
+
f"eigenvalues={eigvals}",
|
|
509
|
+
flush=True
|
|
510
|
+
)
|
|
511
|
+
print(" Dominant dimensions in smallest-eigenvalue direction:", flush=True)
|
|
512
|
+
for k in culprit_order:
|
|
513
|
+
print(
|
|
514
|
+
f" kernel dim {k}, parameter index {inferpar[k]}, "
|
|
515
|
+
f"loading={bad_direction[k]:g}, "
|
|
516
|
+
f"variance={kernel[k, k]:g}",
|
|
517
|
+
flush=True
|
|
518
|
+
)
|
|
519
|
+
|
|
520
|
+
sd = numpy.sqrt(numpy.diag(kernel))
|
|
521
|
+
corr = kernel / numpy.outer(sd, sd)
|
|
522
|
+
if self.verbose:
|
|
523
|
+
print(" correlation matrix:", flush=True)
|
|
524
|
+
print(corr, flush=True)
|
|
525
|
+
|
|
526
|
+
high = numpy.where(numpy.abs(corr) > 0.98)
|
|
527
|
+
|
|
528
|
+
for a, b in zip(high[0], high[1]):
|
|
529
|
+
if a < b:
|
|
530
|
+
print(
|
|
531
|
+
f" high correlation: kernel dims {a}-{b}, "
|
|
532
|
+
f"parameter indices {inferpar[a]}-{inferpar[b]}, "
|
|
533
|
+
f"corr={corr[a, b]:g}",
|
|
534
|
+
flush=True
|
|
535
|
+
)
|
|
536
|
+
|
|
491
537
|
return multivariate_normal.logpdf(x_inf, mean=mean_inf, cov=kernel, allow_singular=False)
|
|
492
538
|
|
|
493
539
|
def calc_weights(self, mat_new, mat_old, kernels):
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|