我正在尝试将2个数组添加到一起,我发现this,问题是,由于某种原因它给了我错误,我不知道如何解决这个问题。 代码:
import numpy as np
import math
import sys
# cd Desktop/python Exercises/pythonEx05
# python main.py mnist_train_1vs7vs8.csv mnist_validation_1vs7vs8.csv
mnist_test_1vs7vs8.csv
# Loads the dataset
data = np.loadtxt(sys.argv[1], delimiter = ',')
# Split the data to matrix X and vector Y
X = data[:, 1:]
Y = data[:, 0]
wMatrix=(len(X[0]),3)
np.zeros(wMatrix)
for i in range(0,len(Y)):
if(yGag!=Y[i]): #Y[i] is the right y, to fix later
wMatrix[i]= [a + c for a, c in
zip(wMatrix[i], X[i])]
最后一行给我错误
argument1 does not support iteration
.. HELP?它只是添加了2个数组,这都是