Message=Found input variables with inconsistent numbers of samples: [58, 191] Source=D:\VS workspace\RFRFE\RFRFE\RFRFE.py StackTrace: File "D:\VS workspace\RFRFE\RFRFE\RFRFE.py", line 65, in calculate_accuracy scores = cross_val_score(svc, X, Y, cv=5) File "D:\VS workspace\RFRFE\RFRFE\RFRFE.py", line 70, in <listcomp> accuracy = np.array([calculate_accuracy(X_wrapper, Y,c, g) for c, g in zip(np.ravel(C), np.ravel(gamma))]) File "D:\VS workspace\RFRFE\RFRFE\RFRFE.py", line 70, in <module> (Current frame) accuracy = np.array([calculate_accuracy(X_wrapper, Y,c, g) for c, g in zip(np.ravel(C), np.ravel(gamma))])
时间: 2024-03-31 12:34:04 浏览: 75
这个错误提示告诉你,在你的代码中,有一个名为`calculate_accuracy`的函数在运行时发现输入的特征数据`X`和标签数据`Y`的样本数量不一致,分别是58和191,因此无法进行交叉验证,导致程序出错。
你需要检查一下代码,找出导致输入数据样本数量不一致的原因。可能是在读取数据时出现了问题,或者在特征工程处理中出现了错误。你需要确保读入的特征数据和标签数据的行数一致,或者在特征工程处理时保证输出数据的行数与输入数据的行数一致。
如果你还有其他问题,可以继续问我。
相关问题
Found input variables with inconsistent numbers of samples: [219974, 0, 0]
This error message indicates that there is a mismatch between the number of samples in the input variables provided for a certain operation. Specifically, there are three input variables, with the first variable having 219974 samples, while the other two variables have 0 samples each. This is not consistent and therefore raises an error.
To resolve this issue, you need to ensure that all input variables have the same number of samples or adjust your code to handle different numbers of samples appropriately.
阅读全文