MCPcopy Create free account
hub / github.com/bigdata-ustc/Agent4Edu / __init__

Method __init__

Code/profile.py:30–46  ·  view source on GitHub ↗
(self, agent_id: int, data_path: str | Path | None = None)

Source from the content-addressed store, hash-verified

28 """
29
30 def __init__(self, agent_id: int, data_path: str | Path | None = None):
31 path = Path(data_path or DATA_PATH) / "profile.json"
32 data = load_json(path)
33 raw = data.get(str(agent_id))
34 if raw is None:
35 raise KeyError(f"No profile for agent/student id {agent_id} in {path}")
36 parts = str(raw).strip().split("\t")
37 if len(parts) < 6:
38 raise ValueError(f"Profile row must contain six tab-separated fields: {raw!r}")
39 self.values = LearnerProfileValues(
40 user_id=int(float(parts[0])),
41 activity_ratio=float(parts[1]),
42 diversity_ratio=float(parts[2]),
43 preference=normalize_concept(parts[3]),
44 success_rate_value=float(parts[4]),
45 ability_value=float(parts[5]),
46 )
47
48 def activity(self) -> str:
49 return "high" if self.values.activity_ratio > ACTIVITY_MEAN else "low"

Callers

nothing calls this directly

Calls 3

load_jsonFunction · 0.90
normalize_conceptFunction · 0.90

Tested by

no test coverage detected