weights=weights+alpha*error*dataMatrix[randIndex] 改为: weights=weights+alpha*error*array(dataMatrix[randIndex]) 解决!