def exp_damped_minute_difference(self, dt1, dt2, alpha):
"""
Computes exp(-alpha * t), where t is the difference between two
datetimes in minutes.
Args:
dt1: A datetime such that dt1 >= dt2.
dt2: A datetime such that dt1 >= dt2.
alpha: A nonnegative float representing the damping factor.
Returns:
A float equal to exp(-alpha * t), where t is the difference between
two datetimes in minutes.
"""
if dt1 < dt2:
raise ValueError('Must have dt1 >= dt2')
if alpha < 0:
raise ValueError('Must have alpha >= 0')
t = self.minute_difference(dt1, dt2)
return math.exp(-alpha * t)
conversation.py 文件源码
python
阅读 25
收藏 0
点赞 0
评论 0
评论列表
文章目录