Logdet Method Profiling Across Matrix Sizes¶
This notebook profiles the runtime of the log-determinant strategies used in neighbayes.
The profiling matrices come from a regular polygon grid generated by the neighbayes.dgp module. Each size n is a grid side length producing an n × n rook-contiguity layout with n² spatial units; the spatial graph is built from the polygon GeoDataFrame returned by the DGP function.
A model names its log-determinant with two arguments: logdet_method, the approximation over ρ, and logdet_decomp, what supplies its exact values (eig, chol or lu). Configurations compared:
exactoneig: precompute the eigenvalues ofWonce; evaluatesum(log(1 - rho * lam_i))per call.exactonchol: one sparse Cholesky (scikit-sparse CHOLMOD) of the D-symmetrisedI - ρWper call, with the symbolic analysis reused.cheboneig/chol: Chebyshev interpolation through exact values at Chebyshev nodes, from the eigenvalues or from sparse Cholesky; evaluation by the Clenshaw recurrence.aaaonchol/lu: AAA rational interpolation (Nakatsukasa, Sète & Trefethen 2018) through exact values at adaptively selected support points. Rational approximation converges exponentially near singularities, needing ~6–15 support points.cholserves undirectedWand is the auto choice for 500 < n ≤ 60000;luserves directedW(KNN, travel time, migration).stochastic: the stochastic Chebyshev expansion of Han, Malioutov & Shin (2015), with no factorization; the auto choice for n > 60000.
For each matrix size, we report:
setup time: build + compile callable logdet function
evaluation time: average cost to evaluate at many rho values
import time
from dataclasses import dataclass
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import pytensor
import pytensor.tensor as pt
import scipy.sparse as sp
from libpysal import graph
from neighbayes import dgp
from neighbayes._logdet import logdet_key, make_logdet_fn
def make_grid_w(n_side: int) -> np.ndarray:
"""Create a row-standardized rook-contiguity matrix from an n_side x n_side polygon grid.
Uses ``dgp.simulate_sar`` with ``create_gdf=True`` to generate the polygon
geometry, then builds a contiguity graph from the returned GeoDataFrame.
"""
gdf = dgp.simulate_sar(n_side=n_side, create_gdf=True)
W = (
graph.Graph.build_contiguity(gdf, rook=True)
.transform("r")
.sparse.toarray()
.astype(np.float64)
)
return W
def compile_logdet_callable(
W: np.ndarray,
method: str,
rho_min: float,
rho_max: float,
):
"""Return a compiled callable f(rho) and its setup time in seconds."""
t0 = time.perf_counter()
rho = pt.scalar("rho")
expr = make_logdet_fn(
W,
method=method,
rho_min=rho_min,
rho_max=rho_max,
)(rho)
fn = pytensor.function([rho], expr)
setup_s = time.perf_counter() - t0
return fn, setup_s
def bench_eval_seconds(fn, rhos: np.ndarray, repeats: int = 5) -> float:
"""Median per-call evaluation latency in microseconds."""
run_times = []
for _ in range(repeats):
t0 = time.perf_counter()
for r in rhos:
_ = fn(float(r))
elapsed = time.perf_counter() - t0
run_times.append(elapsed / len(rhos))
return float(np.median(run_times))
@dataclass
class ProfileConfig:
# Grid side lengths; obs count = n_side². e.g. 10→100, 20→400, 75→5625.
sizes: tuple[int, ...] = (10, 20, 25, 40, 50, 75)
method_specs: tuple[dict, ...] = tuple(
{
"label": f"{m} on {d}" if d != "auto" else m,
"method": m,
"decomp": d,
"rho_min": -0.95,
"rho_max": 0.95,
}
for m, d in [
("eigenvalue", "auto"),
("cheb", "chol"),
("aaa", "chol"),
("aaa", "lu"),
("stochastic", "auto"),
]
)
method_max_n: dict = None
eval_points: int = 80
eval_repeats: int = 3
seed: int = 2026
def __post_init__(self):
if self.method_max_n is None:
self.method_max_n = {spec["label"]: 75 for spec in self.method_specs}
cfg = ProfileConfig()
results = []
skipped = []
for n in cfg.sizes:
W = make_grid_w(n_side=n)
print(f"Profiling n_side={n} ({n * n} obs)...")
for spec in cfg.method_specs:
label = spec["label"]
# The private factories take the internal key the public pair resolves to.
method = logdet_key(spec["method"], spec["decomp"], W=sp.csr_matrix(W))
if n > cfg.method_max_n[label]:
skipped.append(
{
"n_side": n,
"n_obs": n * n,
"method": label,
"reason": "above method_max_n cap",
}
)
continue
rho_min = spec["rho_min"]
rho_max = spec["rho_max"]
rho_grid = np.linspace(rho_min, rho_max, cfg.eval_points)
try:
fn, setup_s = compile_logdet_callable(
W,
method=method,
rho_min=rho_min,
rho_max=rho_max,
)
eval_s = bench_eval_seconds(fn, rho_grid, repeats=cfg.eval_repeats)
results.append(
{
"n_side": n,
"n_obs": n * n,
"method": label,
"logdet_method": method,
"rho_min": rho_min,
"rho_max": rho_max,
"setup_ms": 1e3 * setup_s,
"eval_us": 1e6 * eval_s,
}
)
except Exception as exc:
skipped.append(
{
"n_side": n,
"n_obs": n * n,
"method": label,
"reason": f"failed: {type(exc).__name__}: {exc}",
}
)
res = pd.DataFrame(results).sort_values(["method", "n_obs"]).reset_index(drop=True)
if not res.empty:
res["total_ms"] = res["setup_ms"] + (res["eval_us"] * cfg.eval_points / 1e3)
res
Profiling n_side=10 (100 obs)...
Profiling n_side=20 (400 obs)...
Profiling n_side=25 (625 obs)...
Profiling n_side=40 (1600 obs)...
Profiling n_side=50 (2500 obs)...
Profiling n_side=75 (5625 obs)...
/home/runner/micromamba/envs/test/lib/python3.14/site-packages/tqdm/auto.py:21: TqdmWarning: IProgress not found. Please update jupyter and ipywidgets. See https://ipywidgets.readthedocs.io/en/stable/user_install.html
from .autonotebook import tqdm as notebook_tqdm
| n_side | n_obs | method | logdet_method | rho_min | rho_max | setup_ms | eval_us | total_ms | |
|---|---|---|---|---|---|---|---|---|---|
| 0 | 10 | 100 | aaa on chol | chol_aaa | -0.95 | 0.95 | 23.292615 | 5.013788 | 23.693718 |
| 1 | 20 | 400 | aaa on chol | chol_aaa | -0.95 | 0.95 | 22.967174 | 4.983950 | 23.365890 |
| 2 | 25 | 625 | aaa on chol | chol_aaa | -0.95 | 0.95 | 25.794390 | 5.473462 | 26.232267 |
| 3 | 40 | 1600 | aaa on chol | chol_aaa | -0.95 | 0.95 | 48.268538 | 5.405375 | 48.700968 |
| 4 | 50 | 2500 | aaa on chol | chol_aaa | -0.95 | 0.95 | 73.996440 | 5.490150 | 74.435652 |
| 5 | 75 | 5625 | aaa on chol | chol_aaa | -0.95 | 0.95 | 288.520947 | 5.301550 | 288.945071 |
| 6 | 10 | 100 | aaa on lu | lu_aaa | -0.95 | 0.95 | 26.758032 | 5.450213 | 27.194049 |
| 7 | 20 | 400 | aaa on lu | lu_aaa | -0.95 | 0.95 | 24.454930 | 4.879250 | 24.845270 |
| 8 | 25 | 625 | aaa on lu | lu_aaa | -0.95 | 0.95 | 27.482181 | 4.712800 | 27.859205 |
| 9 | 40 | 1600 | aaa on lu | lu_aaa | -0.95 | 0.95 | 51.142929 | 5.330350 | 51.569357 |
| 10 | 50 | 2500 | aaa on lu | lu_aaa | -0.95 | 0.95 | 87.799522 | 5.699163 | 88.255455 |
| 11 | 75 | 5625 | aaa on lu | lu_aaa | -0.95 | 0.95 | 297.099876 | 5.139862 | 297.511065 |
| 12 | 10 | 100 | cheb on chol | chol_cheb | -0.95 | 0.95 | 426.252050 | 4.903313 | 426.644315 |
| 13 | 20 | 400 | cheb on chol | chol_cheb | -0.95 | 0.95 | 435.358877 | 5.529350 | 435.801225 |
| 14 | 25 | 625 | cheb on chol | chol_cheb | -0.95 | 0.95 | 440.974576 | 5.477350 | 441.412764 |
| 15 | 40 | 1600 | cheb on chol | chol_cheb | -0.95 | 0.95 | 456.580373 | 5.642562 | 457.031778 |
| 16 | 50 | 2500 | cheb on chol | chol_cheb | -0.95 | 0.95 | 829.040541 | 4.950138 | 829.436552 |
| 17 | 75 | 5625 | cheb on chol | chol_cheb | -0.95 | 0.95 | 1235.863139 | 5.106175 | 1236.271633 |
| 18 | 10 | 100 | eigenvalue | eigenvalue | -0.95 | 0.95 | 44.797740 | 5.734250 | 45.256480 |
| 19 | 20 | 400 | eigenvalue | eigenvalue | -0.95 | 0.95 | 66.886060 | 7.466975 | 67.483418 |
| 20 | 25 | 625 | eigenvalue | eigenvalue | -0.95 | 0.95 | 143.284018 | 8.116413 | 143.933331 |
| 21 | 40 | 1600 | eigenvalue | eigenvalue | -0.95 | 0.95 | 1010.027742 | 12.942412 | 1011.063135 |
| 22 | 50 | 2500 | eigenvalue | eigenvalue | -0.95 | 0.95 | 3136.883296 | 17.475200 | 3138.281312 |
| 23 | 75 | 5625 | eigenvalue | eigenvalue | -0.95 | 0.95 | 32916.963913 | 31.887237 | 32919.514892 |
| 24 | 10 | 100 | stochastic | stoch_cheb | -0.95 | 0.95 | 626.725913 | 5.372800 | 627.155737 |
| 25 | 20 | 400 | stochastic | stoch_cheb | -0.95 | 0.95 | 438.982982 | 5.313800 | 439.408086 |
| 26 | 25 | 625 | stochastic | stoch_cheb | -0.95 | 0.95 | 445.545372 | 4.966275 | 445.942674 |
| 27 | 40 | 1600 | stochastic | stoch_cheb | -0.95 | 0.95 | 484.375446 | 5.012450 | 484.776442 |
| 28 | 50 | 2500 | stochastic | stoch_cheb | -0.95 | 0.95 | 568.550669 | 5.195600 | 568.966317 |
| 29 | 75 | 5625 | stochastic | stoch_cheb | -0.95 | 0.95 | 1116.024834 | 5.030912 | 1116.427307 |
if res.empty:
raise RuntimeError("No profiling results were generated.")
# Distinct color + marker per profiled configuration.
method_styles = {
"eigenvalue": {"color": "#ff7f0e", "marker": "s", "linestyle": "-"},
"cheb on chol": {"color": "#d62728", "marker": "^", "linestyle": "-"},
"aaa on chol": {"color": "#2ca02c", "marker": "o", "linestyle": "-"},
"aaa on lu": {"color": "#9467bd", "marker": "v", "linestyle": "-"},
"stochastic": {"color": "#1f77b4", "marker": "D", "linestyle": "-"},
}
fig, axes = plt.subplots(1, 3, figsize=(17, 4.8), constrained_layout=True)
for method, grp in res.groupby("method"):
grp = grp.sort_values("n_obs")
style = method_styles.get(method, {"marker": "o"})
axes[0].plot(grp["n_obs"], grp["setup_ms"], label=method, **style)
axes[1].plot(grp["n_obs"], grp["eval_us"], label=method, **style)
axes[2].plot(grp["n_obs"], grp["total_ms"], label=method, **style)
axes[0].set_title("Setup Time vs n")
axes[0].set_xlabel("observations")
axes[0].set_ylabel("setup time (ms)")
axes[0].set_yscale("log")
axes[0].grid(True, alpha=0.3)
axes[1].set_title("Evaluation Time vs n")
axes[1].set_xlabel("observations")
axes[1].set_ylabel("time per rho eval (us)")
axes[1].set_yscale("log")
axes[1].grid(True, alpha=0.3)
axes[2].set_title(f"Total Time vs n (setup + {cfg.eval_points} evals)")
axes[2].set_xlabel("observations")
axes[2].set_ylabel("total time (ms)")
axes[2].set_yscale("log")
axes[2].grid(True, alpha=0.3)
# Single shared legend to the right of the figure so it doesn't crowd the panels.
handles, labels = axes[0].get_legend_handles_labels()
fig.legend(
handles,
labels,
loc="center left",
bbox_to_anchor=(1.0, 0.5),
frameon=False,
title="configuration",
)
plt.show()
summary = res.pivot_table(
index="n_obs", columns="method", values=["setup_ms", "eval_us", "total_ms"]
).sort_index()
display(summary)
if skipped:
skipped_df = (
pd.DataFrame(skipped).sort_values(["n_side", "method"]).reset_index(drop=True)
)
print("Skipped combinations (due to safety caps or failures):")
display(skipped_df)
| eval_us | setup_ms | total_ms | |||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| method | aaa on chol | aaa on lu | cheb on chol | eigenvalue | stochastic | aaa on chol | aaa on lu | cheb on chol | eigenvalue | stochastic | aaa on chol | aaa on lu | cheb on chol | eigenvalue | stochastic |
| n_obs | |||||||||||||||
| 100 | 5.013788 | 5.450213 | 4.903313 | 5.734250 | 5.372800 | 23.292615 | 26.758032 | 426.252050 | 44.797740 | 626.725913 | 23.693718 | 27.194049 | 426.644315 | 45.256480 | 627.155737 |
| 400 | 4.983950 | 4.879250 | 5.529350 | 7.466975 | 5.313800 | 22.967174 | 24.454930 | 435.358877 | 66.886060 | 438.982982 | 23.365890 | 24.845270 | 435.801225 | 67.483418 | 439.408086 |
| 625 | 5.473462 | 4.712800 | 5.477350 | 8.116413 | 4.966275 | 25.794390 | 27.482181 | 440.974576 | 143.284018 | 445.545372 | 26.232267 | 27.859205 | 441.412764 | 143.933331 | 445.942674 |
| 1600 | 5.405375 | 5.330350 | 5.642562 | 12.942412 | 5.012450 | 48.268538 | 51.142929 | 456.580373 | 1010.027742 | 484.375446 | 48.700968 | 51.569357 | 457.031778 | 1011.063135 | 484.776442 |
| 2500 | 5.490150 | 5.699163 | 4.950138 | 17.475200 | 5.195600 | 73.996440 | 87.799522 | 829.040541 | 3136.883296 | 568.550669 | 74.435652 | 88.255455 | 829.436552 | 3138.281312 | 568.966317 |
| 5625 | 5.301550 | 5.139862 | 5.106175 | 31.887237 | 5.030912 | 288.520947 | 297.099876 | 1235.863139 | 32916.963913 | 1116.024834 | 288.945071 | 297.511065 | 1236.271633 | 32919.514892 | 1116.427307 |
Logdet Approximation Accuracy¶
This section compares how accurately each interpolating method approximates the true log-determinant curve, independent of sampling noise. We compute the exact log|I - ρW| via eigenvalues and compare against each method’s approximation across a dense ρ grid.
from neighbayes._logdet._aaa import (
aaa_logdet_eval,
aaa_logdet_precompute,
)
from neighbayes._logdet._chol_cheb import (
chol_cheb_logdet_eval_vec,
chol_cheb_logdet_precompute,
)
# Use the same W from the last profiling run (or regenerate)
W_accuracy = make_grid_w(n_side=25)
W_sp = sp.csr_matrix(W_accuracy)
# Exact logdet via eigenvalues
W_dense = W_sp.toarray()
eigs = np.linalg.eigvals(W_dense)
rho_grid_acc = np.linspace(-0.95, 0.95, 200)
exact_logdet = np.array([np.sum(np.log(np.abs(1 - r * eigs))) for r in rho_grid_acc])
# cheb on chol: exact values by sparse Cholesky at Chebyshev nodes
# Use the empirical range [0.1, 0.8] where the method is most accurate
rho_grid_emp = np.linspace(0.1, 0.8, 200)
exact_logdet_emp = np.array(
[np.sum(np.log(np.abs(1 - r * eigs))) for r in rho_grid_emp]
)
chol_pre = chol_cheb_logdet_precompute(W_sp, order=None, rho_min=0.1, rho_max=0.8)
chol_approx = chol_cheb_logdet_eval_vec(chol_pre, rho_grid_emp)
chol_err = np.abs(chol_approx - exact_logdet_emp)
# aaa on lu: AAA rational interpolation through sparse-LU values
aaa_pre = aaa_logdet_precompute(W_sp, rho_min=0.1, rho_max=0.8)
aaa_approx = np.array([aaa_logdet_eval(aaa_pre, r) for r in rho_grid_emp])
aaa_err = np.abs(aaa_approx - exact_logdet_emp)
acc_df = pd.DataFrame(
[
{
"method": "cheb on chol",
"max_err": chol_err.max(),
"mean_err": chol_err.mean(),
"rmse": np.sqrt((chol_err**2).mean()),
},
{
"method": "aaa on lu",
"max_err": aaa_err.max(),
"mean_err": aaa_err.mean(),
"rmse": np.sqrt((aaa_err**2).mean()),
},
]
)
display(acc_df)
fig, ax = plt.subplots(figsize=(9, 5), constrained_layout=True)
# Empirical range [0.1, 0.8]
ax.plot(
rho_grid_emp,
chol_approx - exact_logdet_emp,
label="cheb on chol",
alpha=0.7,
color="#d62728",
)
ax.plot(
rho_grid_emp,
aaa_approx - exact_logdet_emp,
label="aaa on lu",
alpha=0.7,
color="#9467bd",
)
ax.axhline(0, color="black", linestyle="--", linewidth=0.8)
ax.set_xlabel("rho")
ax.set_ylabel("approximation error")
ax.set_title("Logdet Error vs Exact (empirical range [0.1, 0.8])")
ax.legend()
ax.grid(True, alpha=0.3)
plt.show()
| method | max_err | mean_err | rmse | |
|---|---|---|---|---|
| 0 | cheb on chol | 4.601691e-08 | 1.405270e-08 | 1.684522e-08 |
| 1 | aaa on lu | 2.617881e-09 | 2.087496e-10 | 4.372022e-10 |
Coefficient and Fit-Time Comparison Across Logdet Methods¶
This section uses a regular polygon grid generated by neighbayes.dgp to simulate one SAR dataset and estimates the same SAR model with each logdet_method and logdet_decomp.
We compare:
posterior mean coefficients (
rho,beta_0,beta_1,beta_2)total wall-clock time to estimate each model
To keep this section runnable in docs contexts, sampling is intentionally modest.
from neighbayes.models import SAR
def simulate_sar_data(n_side: int = 25, seed: int = 2026):
"""Simulate SAR data on an n_side x n_side polygon grid using the DGP module."""
rng = np.random.default_rng(seed)
beta_true = np.array([1.0, 0.8, -0.5], dtype=np.float64)
rho_true = 0.35
sigma_true = 0.7
gdf = dgp.simulate_sar(
n_side=n_side,
rho=rho_true,
beta=beta_true,
sigma=sigma_true,
rng=rng,
create_gdf=True,
)
# Keep the SAR parameterization consistent with model assumptions.
W_graph = graph.Graph.build_contiguity(gdf, rook=True).transform("r")
y = gdf["y"].to_numpy()
X_cols = [c for c in gdf.columns if c.startswith("X_")]
X = gdf[X_cols].to_numpy()
return gdf, y, X, W_graph, rho_true, beta_true
def fit_sar_for_method(
y,
X,
W,
method: str,
decomp: str,
label: str | None = None,
draws: int = 1000,
tune: int = 1000,
seed: int = 2026,
):
"""Fit SAR with a specific logdet configuration and return posterior means + runtime."""
t0 = time.perf_counter()
model = SAR(
y=y,
X=X,
W=W,
logdet_method=method,
logdet_decomp=decomp,
)
idata = model.fit(
draws=draws,
tune=tune,
chains=2,
random_seed=seed,
progressbar=False,
)
elapsed_s = time.perf_counter() - t0
beta_mean = idata.posterior["beta"].mean(("chain", "draw")).to_numpy()
rho_mean = float(idata.posterior["rho"].mean(("chain", "draw")).to_numpy())
return {
"method": label or method,
"beta_mean": beta_mean,
"rho_mean": rho_mean,
"fit_seconds": elapsed_s,
}
# Build the dataset once and sweep the methods we actually compare.
gdf_model, y_model, X_model, W_model, rho_true, beta_true = simulate_sar_data(n_side=25)
methods_for_model = [
{"label": "eigenvalue", "method": "eigenvalue", "decomp": "auto"},
{"label": "cheb on chol", "method": "cheb", "decomp": "chol"},
{"label": "aaa on chol", "method": "aaa", "decomp": "chol"},
{"label": "aaa on lu", "method": "aaa", "decomp": "lu"},
{"label": "stochastic", "method": "stochastic", "decomp": "auto"},
]
fit_rows = []
for spec in methods_for_model:
print(f"Fitting SAR with {spec['label']} ...")
fit_rows.append(
fit_sar_for_method(
y_model,
X_model,
W_model,
method=spec["method"],
decomp=spec["decomp"],
label=spec["label"],
)
)
coef_df = pd.DataFrame(fit_rows)
display(coef_df)
Fitting SAR with eigenvalue ...
Fitting SAR with cheb on chol ...
Fitting SAR with aaa on chol ...
Fitting SAR with aaa on lu ...
Fitting SAR with stochastic ...
| method | beta_mean | rho_mean | fit_seconds | |
|---|---|---|---|---|
| 0 | eigenvalue | [0.882032, 0.810399, -0.520098] | 0.381646 | 2.604775 |
| 1 | cheb on chol | [0.882904, 0.810453, -0.520116] | 0.381063 | 1.562372 |
| 2 | aaa on chol | [0.882808, 0.810445, -0.520111] | 0.381129 | 1.403745 |
| 3 | aaa on lu | [0.882808, 0.810445, -0.520111] | 0.381129 | 1.346286 |
| 4 | stochastic | [0.88145, 0.810363, -0.520086] | 0.382039 | 1.695329 |
Notes¶
exactoneigcarries a one-time O(n³) eigendecomposition cost, then evaluates in O(n) perrho: the reference answer at moderate n.exactoncholpays one sparse Cholesky factorization perrho, with the symbolic analysis reused: exact at any n where the factorization is affordable, but the most expensive per evaluation.chebbuilds Chebyshev coefficients once from exact values at its nodes (from the eigenvalues, or from sparse Cholesky or LU), then evaluates in O(m) per call.aaaevaluates exact values at adaptively selected support points, by sparse Cholesky for undirectedWor sparse LU otherwise, then fits a rational function in barycentric form. It needs only ~6–15 support points, converging exponentially faster than polynomials near singularities.stochasticneeds no factorization; its error is the probes’ Monte Carlo error rather than an interpolation error.Parameter ranges: the timing sweep uses
[-0.95, 0.95]throughout. The accuracy comparison runscheboncholandaaaonluon the empirical range[0.1, 0.8], where they are most accurate (closer to the singularity at ρ=1 needs higher order or more support points).Adjust
ProfileConfig.sizesandmethod_max_nfor deeper stress tests.
import arviz as az
import pandas as pd
# Refit each logdet configuration and compare effective sample sizes for rho.
ess_rows = []
for spec in methods_for_model:
label = spec["label"]
model = SAR(
y=y_model,
X=X_model,
W=W_model,
logdet_method=spec["method"],
logdet_decomp=spec["decomp"],
priors={"rho_lower": -1, "rho_upper": 1},
)
idata = model.fit(
draws=1000,
tune=1000,
chains=2,
random_seed=2026,
progressbar=False,
)
summary = az.summary(idata, var_names=["rho"])
ess = summary.loc["rho", "ess_bulk"]
ess_rows.append(
{
"method": label,
"ess_rho": ess,
}
)
az.plot_trace_dist(idata, var_names=["rho"], compact=True)
plt.suptitle(label)
ess_df = pd.DataFrame(ess_rows)
display(ess_df)
ess_df.set_index("method")["ess_rho"].plot.bar(
ylabel="ESS (rho)", title="Effective Sample Size for rho by Logdet Configuration"
)
| method | ess_rho | |
|---|---|---|
| 0 | eigenvalue | 1678.495157 |
| 1 | cheb on chol | 1928.780258 |
| 2 | aaa on chol | 1950.916246 |
| 3 | aaa on lu | 1950.916246 |
| 4 | stochastic | 1700.709890 |
<Axes: title={'center': 'Effective Sample Size for rho by Logdet Configuration'}, xlabel='method', ylabel='ESS (rho)'>
Method selection policy¶
With logdet_method=None and logdet_decomp="auto" the selector chooses:
eigenvalueforn ≤ 500(one eigendecomposition, then a sum per ρ)aaaoncholfor an undirectedWandaaaonlufor a directed one, for500 < n ≤ 60000, unless the factorization’s fill-in would dominatestochasticforn > 60000(no factorization)
Manual overrides:
Default for most work. Leave both arguments at their defaults.
Eigenvalues at moderate n. Use
logdet_method="eigenvalue"when an O(n³) eigendecomposition is affordable.Chebyshev interpolation. Use
logdet_method="cheb", with the decomposition chosen automatically or named.Directed W.
logdet_decomp="auto"already takeslu; name it to be explicit.Reporting and publication. Record
logdet_method,logdet_decompand therhobounds in every benchmark or model report.