mean = X_train.mean(axis=0) # 计算训练集均值 X_train -= mean # 训练集减去训练集均值 std = X_train.std(axis=0) # 计算训练集标准差 X_train /= std # 训练集除以训练集标准差 X_test -= mean # 测试集减去训练集均值 X_test /= std # 测试集除以训练集标准差