def standardize_data(data):
""" Standardize the training data
X = (X - mu) / (sigma)
Parameters:
-----------
data: numpy ndarray, where rows are data points and cols are dimensions
Returns:
--------
X_std (numpy array) \n
col_mean (numpy array) \n
col_std (numpy array)
"""
col_mean = np.mean(data, axis=0)
col_std = np.std(data, axis=0)
sdata = np.subtract(data, col_mean) / col_std
return sdata, col_mean, col_std
评论列表
文章目录