get_data.py 文件源码

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

项目:Doubly-Stochastic-DGP 作者: ICL-SML 项目源码 文件源码
def get_taxi_stats(data_path=data_path):
    file_name = 'taxi_data_stats.p'
    path = data_path + file_name
    if not os.path.isfile(path):
        download(file_name, data_path=data_path)

    import pickle
    stats = pickle.load(open(path, 'r'))
    sum_X = stats['sum_X']
    sum_X2 = stats['sum_X2']
    n = float(stats['n'])
    X_mean = sum_X / n
    X_std = ((sum_X2 - (sum_X**2)/n)/(n-1))**0.5

    X_mean = np.reshape(X_mean, [1, -1])
    X_std = np.reshape(X_std, [1, -1])

    return X_mean, X_std
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号