git_stats.py 文件源码

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

项目:fabric8-analytics-worker 作者: fabric8-analytics 项目源码 文件源码
def _get_trend(cls, log, starting_date):
        """Get commit count trend based on log.

        :param log: a log on which the trend should be computed
        :param starting_date: starting date of log
        :return: computed trend
        """
        records = [0]
        date = starting_date
        for entry in log:
            if entry['author']['date'] > date + cls._SECONDS_PER_DAY:
                date += cls._SECONDS_PER_DAY
                records.append(0)
            records[-1] += 1

        lr = LinearRegression()
        lr.fit(np.array(range(len(records))).reshape(-1, 1), np.array(records))

        return lr.coef_[0]
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号