arXiv:2608.31133stat.MLcs.LG2026-08

用TMB自动求解神经网络混合效应模型,省去繁琐推导。

Implementing neural network mixed-effects models in Template Model Builder (TMB)

论文配图:Implementing neural network mixed-effects models in Template Model Builder (TMB)
图 1 · 摘自论文原文
  • 基于TMB框架,仅需定义负对数似然,自动处理随机效应积分
  • 实现精确梯度计算,支持复杂非线性结构与单调约束建模
  • 适合统计建模者快速构建高阶混合效应神经网络

神经网络混合效应模型(NMM)通过结合人工神经网络的强大表征能力与混合效应模型捕捉复杂相关结构的能力,受到广泛关注。然而现有估计方法严重依赖手动推导目标函数和梯度,迫使采用简化近似,极大限制了模型的复杂度与精度。本文提出一种通用框架,利用模板模型构建器(TMB)实现NMM。借助自动微分与拉普拉斯近似,用户仅需指定负联合对数似然及正则化项,框架即可自动积分出随机效应,并计算边际目标函数及其精确梯度,无需手动推导或人为近似。我们在两个数值例子中验证了该方法的效率、灵活性与统计性能,包括单调性约束下的NMM应用。可复现代码已提供,便于推广使用。

原文摘要 · Abstract (English)

Neural network mixed-effects models (NMMs) have gained traction by combining the strong representation and predictive power of artificial neural networks with the capacity of mixed-effects modeling to capture complex correlation structures. However, existing estimation approaches rely heavily on manual derivations of objective functions and gradients, which inherently forces simplifying approximations and severely constrains the complexity and accuracy of NMMs. In this work, we introduce a general framework for implementing NMMs using Template Model Builder (TMB). By leveraging automatic differentiation and Laplace approximation, TMB requires users to specify only the negative joint log-likelihood and any regularization terms. The framework automatically integrates out random effects and evaluates the marginal objective function alongside its exact gradients, eliminating the need for manual derivations or ad hoc approximations. We demonstrate the efficiency, flexibility, and statistical performance of TMB-based NMMs across two numerical examples, including an application to monotonic NMMs. Reproducible code is provided to facilitate broader adoption.

神经网络混合效应模型TMB自动微分

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。