franknocode commited on
Commit
5366799
·
verified ·
1 Parent(s): 86eded0

Update tools/presence_demo.py

Browse files
Files changed (1) hide show
  1. tools/presence_demo.py +32 -13
tools/presence_demo.py CHANGED
@@ -1,15 +1,34 @@
1
- # presence_demo.py
2
- # Minimal stub: computes a dummy Presence Index p(t)
3
- # Replace with real logic when ready.
4
-
5
- def presence_dummy():
6
- cra_sim = 0.7
7
- A = 0.6
8
- inertia = 0.1
9
- reset = 0
10
- z = cra_sim + A - inertia - reset
11
- p = 1 / (1 + pow(2.718, -z)) # sigmoid
12
- print(f"Dummy Presence Index p(t) = {p:.2f}")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
13
 
14
  if __name__ == "__main__":
15
- presence_dummy()
 
 
1
+ """
2
+ presence_demo.py
3
+ ---------------------------------
4
+ Quick proof-of-concept:
5
+ legge hud_metrics_sample.csv
6
+ calcola Presence Index p(t)
7
+ stampa il risultato
8
+ Formula:
9
+ z = CRA_sim + Alignment_A − Inertia_I − Reset_flag
10
+ p = 1 / (1 + e^(−z)) # sigmoid
11
+ Replace with the full ACI / RCS pipeline when ready.
12
+ """
13
+
14
+ import math
15
+ import pandas as pd
16
+ from pathlib import Path
17
+
18
+ CSV_PATH = Path(__file__).parent / "hud_metrics_sample.csv"
19
+
20
+ def presence_from_csv(csv_path=CSV_PATH):
21
+ df = pd.read_csv(csv_path)
22
+ row = df.iloc[0]
23
+ z = (
24
+ row["cra_similarity"]
25
+ + row["alignment_A"]
26
+ - row["inertia_I"]
27
+ - row["reset_flag"]
28
+ )
29
+ p = 1 / (1 + math.e ** (-z)) # sigmoid
30
+ return round(p, 3)
31
 
32
  if __name__ == "__main__":
33
+ p_val = presence_from_csv()
34
+ print(f"Presence Index p(t) = {p_val}")