Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/Skieriya/fMRI-key-generation-with-TRIBEv2/llms.txt

Use this file to discover all available pages before exploring further.

The Neural Vault benchmark evaluates five distinct key generation strategies applied to the same standardized fMRI feature matrix derived from 5 stimulus classes. Each method receives identical input — a StandardScaler-normalized feature array — and produces a binary key representation that is then measured against class prototypes using Hamming distance. This controlled setup isolates the contribution of the key generation algorithm itself, independent of the input data.

Key Generation Methods

All five methods are evaluated by evaluate_keygen_method(X, y, keygen_fn), which computes per-class prototype keys and measures Hamming distances between each genuine sample’s key and its class prototype, and between each impostor sample’s key and all non-matching prototypes.
def evaluate_keygen_method(X, y, keygen_fn):
    genuine_dists, impostor_dists = [], []
    prototypes = np.array([X[y == c].mean(axis=0) for c in range(N_CLASSES)])
    ref_keys = [keygen_fn(proto) for proto in prototypes]

    for c in range(N_CLASSES):
        gen_keys = np.array([keygen_fn(sample) for sample in X[y == c]])
        imp_keys = np.array([keygen_fn(sample) for sample in X[y != c]])

        ref_key_matrix = np.atleast_2d(ref_keys[c])
        genuine_dists.extend(cdist(ref_key_matrix, gen_keys, metric='hamming').flatten())
        impostor_dists.extend(cdist(ref_key_matrix, imp_keys, metric='hamming').flatten())

    return np.array(genuine_dists), np.array(impostor_dists)
The five key generation methods benchmarked are:
  • SHA256np.frombuffer(hashlib.sha256(f.tobytes()).digest(), dtype=np.uint8) applied per sample. Produces a 256-bit cryptographic hash directly from the raw float bytes, returned as a uint8 array. Sensitive to any bit-level change in the input.
  • HMACnp.frombuffer(hmac.new(b"secret_vault", f.tobytes(), hashlib.sha256).digest(), dtype=np.uint8). Keyed hash with a fixed secret, providing message authentication semantics. Like SHA256, it is not designed for biometric similarity.
  • BioHashingGaussianRandomProjection(n_components=128, random_state=42) applied to each sample, followed by binarization at threshold 0.0. Projects the feature vector into a random 128-dimensional subspace and thresholds to produce a binary string.
  • NeuralNeuralVaultFewShot transformer embeddings are quantized and binarized at the global median of the embedding matrix: binarize(X_emb[:, :128], threshold=np.median(X_emb[:, :128])). The embedding is learned via triplet loss, so genuine samples cluster tightly in latent space.
  • NeuralVault — Cosine similarity scoring against per-class prototype embeddings in the learned metric space, using verify_similarity(X_emb, prototypes, y). This variant does not rely on Hamming distance but instead measures cosine distance, making it the most semantically aligned to the biometric verification task.

Evaluation Metrics

Three metrics characterize the separability and error rate of each method:
  • d-prime (d′) — A signal detection theory measure of separability between the genuine and impostor Hamming distance distributions. Higher is better; values above 2.0 indicate excellent separation. Computed as |μ_impostor − μ_genuine| / √(0.5 × (σ²_genuine + σ²_impostor)).
  • EER (Equal Error Rate) — The operating point where the False Acceptance Rate (FAR) equals the False Rejection Rate (FRR). Lower is better. Computed via Brent’s root-finding method on the interpolated ROC curve.
  • ROC-AUC — Area under the Receiver Operating Characteristic curve, reported for the NeuralVault cosine scoring path only. Values near 1.0 indicate near-perfect discrimination.

Benchmark Results

The table below summarizes baseline performance for each method on the unperturbed fMRI feature matrix.
Methodd-primeEER (%)
Neural5.9500.75%
NeuralVault4.8350.94%
BioHashing2.20815.09%
HMAC0.25052.58%
SHA2560.13648.39%
The Neural and NeuralVault methods achieve a 20× lower EER than BioHashing and roughly 50–70× lower than the cryptographic hash approaches. SHA256 and HMAC hover near 50% EER, which is equivalent to random chance — their Hamming distance distributions for genuine and impostor pairs are essentially indistinguishable.

Neural Classification Metrics

The underlying NeuralVaultFewShot transformer model is evaluated independently through 40 few-shot classification episodes, each sampling 4 support samples and 4 query samples per class. Aggregated across all episodes:
MetricScore
Accuracy98.12%
Macro F1-Score0.9810
ROC-AUC0.9995
These results confirm that the learned embedding space is highly discriminative across all 5 fMRI stimulus classes before any key derivation step is applied.

Noise Robustness

EER degradation curves under AWGN noise (0–30 dB SNR) and motion artifact simulation (0–30% dropout) for all five methods.

Results & Output Files

Full pipeline output structure, prototype key values, generated report files, and the 6-panel visualization dashboard.

Build docs developers (and LLMs) love