E论文程序LBPGLCM_SVM_Project-mainLBP朱笔特改py81 VisibleDeprecationWarning Creating an ndarray from ragged nested sequences which is a list-or-tuple of lists-or-tuples-or ndarrays with different lengths or sh
这个错误是因为输入的特征数据是一维的,而SVM模型需要的是二维的特征数据。你可以通过使用reshape()函数将数据转换为二维数组来解决这个问题。
根据错误信息,你可以尝试将特征数据X_train和X_test转换为二维数组。例如,使用X_train.reshape(-1, 1)和X_test.reshape(-1, 1)将数据转换为列向量。
修改后的代码如下所示:
X_train = X_train.reshape(-1, 1)
X_test = X_test.reshape(-1, 1)
然后再次运行代码,应该就可以解决这个问题了。
原文地址: http://www.cveoy.top/t/topic/hYiB 著作权归作者所有。请勿转载和采集!