Nahid Abdullah Al, Serafin Linda, Mancuso Nicholas
Alfred E. Mann School of Pharmacy and Pharmaceutical Sciences, University of Southern California, Los Angeles, CA, USA.
Department of Population and Public Health Sciences, Keck School of Medicine, University of Southern California, Los Angeles, CA, USA.
bioRxiv. 2025 Jul 20:2025.07.14.662216. doi: 10.1101/2025.07.14.662216.
In many applications, from statistical inference to machine learning, calculating the trace of a matrix is a fundamental operation, yet may be infeasible due to memory constraints. Stochastic trace estimation offers a practical solution by using randomized matrix-vector products to obtain accurate, unbiased estimates without constructing the full matrix in memory. Here, we present , a Python framework for scalable trace estimation that leverages efficient linear operator representations of matrices while supporting automatic differentiation and hardware acceleration. supports state-of-the-art trace estimators and through simulations we recapitulate results demonstrating their high accuracy while significantly reducing runtime and memory usage when compared with direct trace computation. As a proof of concept, we implemented a stochastic heritability estimator using traceax requiring only several lines of code. Overall, provides a versatile tool for stochastic trace estimation that can be easily integrated into existing inferential pipelines.
在许多应用中,从统计推断到机器学习,计算矩阵的迹是一项基本操作,但由于内存限制可能不可行。随机迹估计提供了一种实用的解决方案,通过使用随机矩阵向量乘积来获得准确、无偏的估计,而无需在内存中构建完整矩阵。在这里,我们展示了一个用于可扩展迹估计的Python框架,该框架利用矩阵的高效线性算子表示,同时支持自动微分和硬件加速。该框架支持最先进的迹估计器,通过模拟,我们重现了结果,证明了它们的高精度,同时与直接迹计算相比,显著减少了运行时间和内存使用。作为概念验证,我们使用traceax实现了一个随机遗传力估计器,只需要几行代码。总体而言,traceax为随机迹估计提供了一个通用工具,可以很容易地集成到现有的推理管道中。