我想为神经网络标准化我的输入数据。
数据如下所示:
data= np.array([[0,0,0,0,233,2,0,0,0],[0,0,0,23,50,2,0,0,0],[0,0,0,0,3,20,3,0,0]])
这是我使用的功能。由于零,它不起作用。
def standardize(data): #dataframe
_,c = data.shape
data_standardized = data.copy(deep=True)
for j in range(c):
x = data_standardized.iloc[:, j]
avg = x.mean()
std = x.std()
x_standardized = (x - avg)/ std
data_standardized.iloc[:, j] = x_standardized
return data_standardized