Semantic-Physiont / tools /presence_demo.py
franknocode's picture
Update tools/presence_demo.py
5366799 verified
raw
history blame contribute delete
851 Bytes
"""
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}")