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
评论列表
文章目录