Skip to content

v1.7.2

Latest

Choose a tag to compare

@settylab-dotto-bot settylab-dotto-bot released this 18 Nov 00:10
42112b5
  • bugfix: serialization now fails fast when a covariance function (or a predictor) belongs to a class that could not be resolved again on loading. Mellon stores classes by name and recovers them with getattr(import_module(module_name), classname), so a class that is not bound at the top level of its module — most commonly one defined inside a factory function — produced a file that Covariance.from_dict / Predictor.from_json could not load. Previously to_json() wrote that file without complaint and the AttributeError surfaced only at load time, potentially long after the fit it was meant to preserve. to_json() / to_dict() now raise a TypeError naming the offending qualified name and asking for a module-level definition. Module-level covariance functions, including user-defined ones, are unaffected and still round-trip exactly; existing serialized files still load. Predictor.copy() is deliberately not affected, as it never resolves the predictor class by name.
  • the guard above lives in Covariance.__getstate__, which is also Python's copy/pickle hook, so copy.deepcopy() and pickle.dumps() of such a covariance function now raise the same TypeError. Previously deepcopy succeeded, since it carries the class by reference instead of resolving it by name; pickle failed on its own. Only classes that were already unserializable are affected. For the same reason Predictor.copy() of a predictor with such a covariance function now raises TypeError up front instead of the previous AttributeError from the load path — it did not work before either.
  • composite covariance functions (+, *, **) now record the full module of their class instead of only the top-level package, so a user-defined CovariancePair subclass living in a subpackage can be resolved on loading. Files written by earlier versions continue to load unchanged.
  • compute_d_factal is renamed to compute_d_fractal, correcting the spelling of "fractal". The new name is the canonical one and is what d_method="fractal" now calls internally. compute_d_factal continues to work: it is retained as an alias that forwards to compute_d_fractal, is still exported from mellon.parameters, and remains listed in __all__, so existing code needs no change. No deprecation warning is emitted — the old name is used widely enough downstream that a warning on by default would be noise rather than signal. Callers writing new code should prefer compute_d_fractal.
  • removed: the mellon-test console script. It was declared as mellon-test = "pytest:main" while pytest is only a dev extra, so on a normal install it failed immediately with ModuleNotFoundError: No module named 'pytest'. It could not have worked even with pytest present: the installed distribution contains only the mellon package, never the test suite, and the script invoked pytest.main() with no arguments — so it would have collected from whatever directory it happened to be run in. Run the tests from a source checkout with pytest instead. This removes a published command, so any script invoking mellon-test will now get "command not found" rather than the ModuleNotFoundError it got before.
  • bugfix: declare packaging as a runtime dependency. mellon.base_predictor has imported packaging.version at module scope since v1.5.0, but packaging was never listed in the project dependencies, so installing Mellon into an environment that provided only its declared requirements failed at import mellon with ModuleNotFoundError: No module named 'packaging'. Environments that happened to supply packaging transitively — including any install of the dev or docs extras — were unaffected, which is why it went unnoticed. If you have ever hit ModuleNotFoundError: No module named 'packaging' on a fresh install of Mellon, this is the fix.
  • the GP leverage diagonal diag(B M^-1 B^T) is now computed with a Cholesky solve instead of an explicit jnp.linalg.inv(M). M = sigma^2 K_uu + B^T B (plus jitter) is symmetric positive definite by construction, so the inverse was never needed. All five sites are converted: _LandmarksConditional._compute_obs_variance and ._leverage (scalar and per-feature sigma) and _LandmarksConditionalCholesky._leverage. Results are unchanged to within rounding (worst relative difference 1.8e-7 across 30 public-API comparisons; 1.9e-4 on a real 5,000-landmark problem with cond(M) = 2.5e13, where both forms agree with a QR reference to about 1e-4 and neither is uniformly the more accurate).
  • this also removes a segfault. jnp.linalg.inv lowers to LU (getrf), which dispatches to OpenBLAS's threaded dgetrf_parallel; at 5,000 landmarks that routine overflows the stack of the thread JAX calls it on and the process dies with SIGSEGV. Measured on OpenBLAS 0.3.30: 12/12 crashes end-to-end at OPENBLAS_NUM_THREADS=16 against 0/12 at 1 thread, and 6/12 against 0/12 for the unpatched and patched code run back to back (not concurrently). Affects any caller using landmarks with obs_variance=True or Predictor.leverage(). The Cholesky path uses potrf and is unaffected. export OPENBLAS_NUM_THREADS=1 remains a valid workaround on older versions.
  • note: with jitter=0, or in float32, the Cholesky form returns NaN for matrices where the old inv returned finite values. In every such case checked the old values were numerically meaningless (errors above 25%, leverages outside [0, 1]), so this surfaces a failure that was previously silent. The default jitter=1e-6 in float64 — what every estimator uses — is unaffected.