[问题/Issue] 章节8.2.5/9.3.1:记忆召回的排序评分算法中时间因子的使用名词,两个章节使用名词不一致
1. 遇到问题的章节 / Affected Chapter
章节8.2.5、章节9.3.1
2. 问题类型 / Issue Type
文档不清晰 / Unclear Documentation
3. 具体问题描述 / Problem Description
章节8.2.5/9.3.1:记忆召回的排序评分算法中时间因子的使用名词,两个章节使用名词不一致。章节8.2.5使用的名词是“时间衰减”、“时间近因性”,章节9.3.1中使用了“新近性”。两个章节计算时间近似性的算法基本一致,建议这两个章节的内容都使用统一的名词,减少理解成本。
4. 问题重现材料 / Reproduction Materials
章节8.2.5(用词“时间衰减”、“时间近因性”):
分值计算函数
def _calculate_recency_score(self, timestamp: str) -> float: """计算时间近因性得分""" try: memory_time = datetime.fromisoformat(timestamp) current_time = datetime.now() age_hours = (current_time - memory_time).total_seconds() / 3600
指数衰减:24⼩时内保持⾼分,之后逐渐衰减
decay_factor = 0.1 # 衰减系数 recency_score = math.exp(-decay_factor * age_hours / 24) return max(0.1, recency_score) # 最低保持0.1的基础分数 except Exception: return 0.5 # 默认中等分数
章节9.3.1(用词“新近性”)
对应内容:4. 最⼩规则:不引⼊来源/优先级等分类维度,避免复杂度增⻓。实践表明,基于相关性和新近性的简单评分机制,在⼤多数场景下已经⾜够有效。
分值计算函数(“计算时间近因性分数”、“新近性分数(0.0-1.0)”
def _calculate_recency(self, timestamp: datetime) -> float: """计算时间近因性分数 使⽤指数衰减模型,24⼩时内保持⾼分,之后逐渐衰减。 Args: timestamp: 信息的时间戳 Returns: float: 新近性分数(0.0-1.0) """ import math age_hours = (datetime.now() - timestamp).total_seconds() / 3600
指数衰减:24⼩时内保持⾼分,之后逐渐衰减
decay_factor = 0.1 # 衰减系数 recency_score = math.exp(-decay_factor * age_hours / 24) return max(0.1, min(1.0, recency_score)) # 限制在 [0.1, 1.0] 范围内
5. 补充信息 / Additional Information
No response
确认事项 / Verification
- 我已阅读过相关章节的文档 / I have read the relevant chapter documentation
- 我已搜索过现有的Issues,确认此问题未被报告 / I have searched existing Issues and confirmed this hasn't been reported
- 我已尝试过基本的故障排除(如重启、重新安装依赖等) / I have tried basic troubleshooting (restart, reinstall dependencies, etc.)
Source: datawhalechina/hello-agents