Metadata-Version: 2.4
Name: adaptive-reutility-index
Version: 0.1.0
Summary: A framework for evaluating the static recreatability of adaptive gating solutions.
Author: Gabriel Duque Díaz
License-Expression: Apache-2.0
Project-URL: Homepage, https://github.com/GepoCode345/Adaptive-ReUtility-Index
Project-URL: Repository, https://github.com/GepoCode345/Adaptive-ReUtility-Index
Project-URL: Issues, https://github.com/GepoCode345/Adaptive-ReUtility-Index/issues
Keywords: adaptive systems,adaptive gating,machine learning,model evaluation,model distillation,static recreation,research
Classifier: Programming Language :: Python :: 3
Classifier: Operating System :: OS Independent
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
License-File: NOTICE
Requires-Dist: numpy
Requires-Dist: pandas
Provides-Extra: dev
Requires-Dist: pytest>=8.0; extra == "dev"
Dynamic: license-file

# Adaptive (Re)Utility Index — ARUI

**ARUI** is an experimental framework for estimating how suitable the learned
behaviour of an adaptive gating system may be for recreation using static gate
weights. ARUI can be used to measure how suitable an adaptive-model seed may be
for static recreation, while also providing the suggested fixed gate weights.


> **Status:** Experimental / pre-validation.  
> ARUI v0.1.0 defines the proposed methodology. Its ability to predict
> successful static recreation is currently being evaluated experimentally.

---

## Motivation

Adaptive gating systems can dynamically change the contribution of different
information sources. This flexibility may improve predictive performance, but
it can also increase architectural and computational complexity.

In some cases, an adaptive gate may learn a useful allocation that changes only
slightly over time. If so, its behaviour may potentially be approximated using
a simpler static gate.

A seed with high adaptive gain and low gate displacement receives a higher
ARUI value. The ARUI value cannot currently go beyond its adaptive gain value.

ARUI may also help avoid using large computational power whilst being uncertain
about the use of the adaptive weights for fixed models.

---

# Methodology

Assume an adaptive gate contains \(K\) data types and is evaluated across
\(T\) observations.

At observation \(t\), the gate produces:

\[
\mathbf{w}_t =
(w_{t,1}, w_{t,2}, \ldots, w_{t,K})
\]

For a normalized gate:

\[
\sum_{j=1}^{K} w_{t,j} = 1
\]

---

## 1. Mean gate weight

For each data type \(j\), ARUI calculates its mean gate weight:

\[
\bar{w}_j =
\frac{1}{T}
\sum_{t=1}^{T} w_{t,j}
\]

The vector

\[
\bar{\mathbf{w}}
=
(\bar{w}_1,\bar{w}_2,\ldots,\bar{w}_K)
\]

forms the proposed static recreation of the adaptive gate.

For normalized gate outputs, the mean weights also sum to 1, apart from
floating-point error.

---

## 2. Mean variation

For each data type, ARUI measures its mean absolute variation around its mean
gate weight:

\[
d_j =
\frac{1}{T}
\sum_{t=1}^{T}
|w_{t,j}-\bar{w}_j|
\]

This measures the typical distance between the dynamic gate allocation and the
constant weight that would be used during static recreation.

---

## 3. Seed displacement

The overall seed displacement is defined as the mean variation across all
\(K\) data types:

\[
D_s =
\frac{1}{K}
\sum_{j=1}^{K} d_j
\]

A lower \(D_s\) indicates that the adaptive gate remains closer to its mean
configuration.

A perfectly static gate has:

\[
D_s = 0
\]

---

## 4. Adaptive gain

ARUI defines signed adaptive gain so that a positive value always indicates
better adaptive performance.

For a metric where **higher_is_better** is True:

\[
G_s = A_s - F_s
\]

For a metric where **higher_is_better** is False:

\[
G_s = F_s - A_s
\]

where:

- \(A_s\) is the adaptive performance for seed \(s\)
- \(F_s\) is the corresponding fixed-model performance

Through this calculation:

- \(G_s > 0\): adaptive model performed better
- \(G_s = 0\): equal performance
- \(G_s < 0\): adaptive model underperformed

---

## 5. Adaptive (Re)Utility Index

ARUI combines adaptive gain and weight displacement:

\[
\boxed{
ARUI_s =
\frac{G_s}{1+D_s}
}
\]

A higher ARUI therefore favours solutions that combine:

- greater adaptive performance gain;
- lower average gate variation.

The addition of 1 also ensures the denominator remains defined when:

\[
D_s=0
\]

---
