File size: 851 Bytes
5366799
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
a84698a
 
5366799
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
"""
presence_demo.py
---------------------------------
Quick proof-of-concept:
• legge hud_metrics_sample.csv
• calcola Presence Index p(t)
• stampa il risultato
Formula:
    z = CRA_sim + Alignment_A − Inertia_I − Reset_flag
    p  = 1 / (1 + e^(−z))      # sigmoid
Replace with the full ACI / RCS pipeline when ready.
"""

import math
import pandas as pd
from pathlib import Path

CSV_PATH = Path(__file__).parent / "hud_metrics_sample.csv"

def presence_from_csv(csv_path=CSV_PATH):
    df = pd.read_csv(csv_path)
    row = df.iloc[0]
    z = (
        row["cra_similarity"]
        + row["alignment_A"]
        - row["inertia_I"]
        - row["reset_flag"]
    )
    p = 1 / (1 + math.e ** (-z))  # sigmoid
    return round(p, 3)

if __name__ == "__main__":
    p_val = presence_from_csv()
    print(f"Presence Index p(t) = {p_val}")