我是这方面的新手,所以我很感激你的帮助.我正在玩mnist数据集.我从http://g.sweyla.com/blog/2012/mnist-numpy/获取了代码,但将"images"更改为2维,以便每个图像都是特征向量.然后我在数据上运行PCA,然后运行SVM并检查分数.一切似乎工作正常,但我得到以下警告,我不知道为什么.
"DataConversionWarning: A column-vector y was passed when a 1d array was expected.\
Please change the shape of y to (n_samples, ), for example using ravel()."
Run Code Online (Sandbox Code Playgroud)
我尝试了几件事,但似乎无法摆脱这个警告.有什么建议?这是完整的代码(忽略缺少的缩进,似乎他们有点混乱在这里复制代码):
import os, struct
from array import array as pyarray
from numpy import append, array, int8, uint8, zeros, arange
from sklearn import svm, decomposition
#from pylab import *
#from matplotlib import pyplot as plt
def load_mnist(dataset="training", digits=arange(10), path="."):
"""
Loads MNIST files into 3D numpy arrays
Adapted from: http://abel.ee.ucla.edu/cvxopt/_downloads/mnist.py
"""
if dataset …Run Code Online (Sandbox Code Playgroud)