agentsclimarketplace

Matrix numerical stability validation

Skill HolobiomicsLab/asb-skill-collections/collections/metabolomics/v2/skills/matrix-numerical-stability-validation

Curated, evidence-grounded skill and software-tool collections for scientific AI agents, generated by the AgenticScienceBuilder

Install
npx -y skills add HolobiomicsLab/asb-skill-collections --skill matrix-numerical-stability-validation

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

One thing to look at

  • 14 stars14 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.

What its author says it does

Copied from the file, not written here

Use when after computing a Jacobian (precision) matrix from covariance matrix inversion in MInfer, or whenever precision matrices are derived via numerical linear algebra operations on covariance matrices.

The file declares its own license as CC-BY-4.0. That is the author’s claim about this one file, and it is not the same thing as the license GitHub reports for the repository, which is listed with the other numbers below.

SKILL.md

6.9 KB, ~1.1k tokens by cl100k_base, as published. Nobody here has run it

matrix-numerical-stability-validation

Summary

Validate the numerical properties and computational integrity of matrices (especially precision/Jacobian matrices) by checking symmetry, dimensions, and numerical stability before downstream analysis. This skill ensures that matrix inversion and negation operations in metabolomic network inference produce reliable results suitable for biological interpretation.

When to use

After computing a Jacobian (precision) matrix from covariance matrix inversion in MInfer, or whenever precision matrices are derived via numerical linear algebra operations on covariance matrices. Validation is critical before using the matrix for network visualization, interaction inference, or statistical testing, as numerical errors in inversion can propagate through downstream analyses.

When NOT to use

  • Input is already a confirmed precision/correlation matrix from external software; re-validation may be redundant unless cross-checking is the goal.
  • Covariance matrix has not been generated or is unavailable; validation requires the parent matrix to diagnose inversion failures.
  • Sample size is very small (n << number of metabolites); in such underdetermined regimes, numerical instability is expected and validation alone cannot repair it.

Inputs

  • covariance matrix (from MetaboAnalyst preprocessing or generate_covariance function)
  • metabolite count or expected matrix dimensions
  • numerical precision tolerance (optional; defaults to machine epsilon)

Outputs

  • validated Jacobian (precision) matrix
  • validation report (symmetry, dimensions, condition number, eigenvalue range)
  • structured output file (e.g., CSV, RDS, or HDF5) with metadata

How to apply

After computing the Jacobian matrix by negating the inverse of the covariance matrix, systematically verify: (1) symmetry—confirm the matrix is symmetric (or near-symmetric within machine precision), as precision matrices must be symmetric; (2) dimensions—check that matrix rows and columns match the number of metabolites; (3) numerical stability—inspect for extremely small eigenvalues, condition number, and presence of NaN or Inf values that indicate computation failure. Export the validated matrix as a structured output file only after all checks pass. If any check fails, flag the result and investigate the upstream covariance matrix quality or numerical precision settings.

Related tools

  • MInfer (R package that computes Jacobian matrices from covariance matrices and requires validation of the precision matrix output) — https://github.com/cellbiomaths/MInfer
  • R (Programming environment for numerical linear algebra operations and matrix validation (eigen decomposition, norm checks, symmetry tests))
  • MetaboAnalyst (Upstream tool providing normalized metabolite abundance data and covariance matrices that serve as input to Jacobian computation and validation)

Examples

# After calculating Jacobian matrix in R:
J <- calculate_jacobian(cov_matrix, interactions, icount = 15)
# Validate:
isSymmetric(J, tol = 1e-10) && all(is.finite(J)) && Matrix::rcond(J) > 1e-10

Evaluation signals

  • Matrix symmetry test: max(abs(J - t(J))) < epsilon (where epsilon ≈ 1e-10); symmetric matrices indicate correct mathematical structure.
  • Dimension check: nrow(J) == ncol(J) == number of metabolites; mismatches indicate data shape corruption.
  • Condition number: cond(J) is finite and not excessively large (typically < 1e10); very large condition numbers flag ill-conditioning from poor covariance quality.
  • Eigenvalue range: all eigenvalues are real-valued and bounded away from zero (no NaN, Inf, or near-zero eigenvalues); negative or zero eigenvalues may indicate non-positive-definite covariance.
  • No numerical artifacts: absence of NaN, Inf, or extremely small/large values (e.g., < 1e-300 or > 1e300) in the matrix; such values typically signal computation failure.

Limitations

  • Numerical stability validation cannot fully recover from ill-conditioned covariance matrices; if the input covariance matrix is poorly conditioned, validation will flag the problem but inversion will remain unreliable.
  • Very small sample sizes relative to the number of metabolites lead to singular or near-singular covariance matrices, making inversion numerically unstable regardless of validation checks.
  • No validation procedure is specified in the MInfer README; practitioners must implement custom checks using standard linear algebra diagnostics (eigenvalue decomposition, condition number, symmetry norm).
  • Validation thresholds (e.g., machine epsilon tolerance, acceptable condition number bound) are not prescribed in the source material and must be chosen based on downstream analysis requirements.

Evidence

  • [other] Validate matrix properties (symmetry, dimensions, numerical stability) and export as a structured output file.: "Validate matrix properties (symmetry, dimensions, numerical stability) and export as a structured output file."
  • [other] Compute the inverse of the covariance matrix using numerical linear algebra in R. 3. Negate the inverse to obtain the Jacobian (precision) matrix, representing partial correlation structure.: "Compute the inverse of the covariance matrix using numerical linear algebra in R. 3. Negate the inverse to obtain the Jacobian (precision) matrix"
  • [other] MInfer provides Jacobian matrix computation as a core tool within its workflow, positioned after covariance matrix generation: "MInfer provides Jacobian matrix computation as a core tool within its workflow, positioned after covariance matrix generation"

What ships with it

Read from the repository

Just SKILL.md. No reference files, no scripts.

Keep looking

Skills are one crate of 328,083. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.