conversation.py 文件源码

python
阅读 25 收藏 0 点赞 0 评论 0

项目:facebook-message-analysis 作者: szheng17 项目源码 文件源码
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)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号