Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/349.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 找不到类标签。学习错误_Python_Machine Learning_Scikit Learn_Svm - Fatal编程技术网

Python 找不到类标签。学习错误

Python 找不到类标签。学习错误,python,machine-learning,scikit-learn,svm,Python,Machine Learning,Scikit Learn,Svm,错误: 不理解错误,在学习linearSVC时未获取。在其他数据集(如iris)上使用BAggingClassifier时也可以得到它。谢谢 编辑: 数据集-> 使用np.load()。要复制它,您只需要将sample_weights参数传递到fit方法中,其中某个类的样本的权重完全为零。这就是当Bagging算法随机将样本权重归零以创建基本估计量的子集时隐式发生的情况。它倾向于排除大多数类,如果使用这种SVM实现,则会导致错误 我会报告这个错误。您可以使用另一种基本估计量,或者使用另一种集成

错误:

不理解错误,在学习
linearSVC
时未获取。在其他数据集(如iris)上使用BAggingClassifier时也可以得到它。谢谢

编辑:

数据集->


使用
np.load()。要复制它,您只需要将sample_weights参数传递到fit方法中,其中某个类的样本的权重完全为零。这就是当Bagging算法随机将样本权重归零以创建基本估计量的子集时隐式发生的情况。它倾向于排除大多数类,如果使用这种SVM实现,则会导致错误


我会报告这个错误。您可以使用另一种基本估计量,或者使用另一种集成方法代替bagging,而不是使用支持向量机,这可能会对您有所帮助。

请在下一票中说明。这对我有帮助。谢谢你提供数据集的代码?@Olologin我已经在问题中添加了数据集。抱歉,它有点大,这就是为什么我没有在开始上传。请发布一个链接到错误报告。我想还没有修好。这个还没有修好。
warning: class label 1 specified in weight is not found
warning: class label 1 specified in weight is not found
warning: class label 1 specified in weight is not found
warning: class label 1 specified in weight is not found
warning: class label 1 specified in weight is not found
warning: class label 1 specified in weight is not found
warning: class label 1 specified in weight is not found
warning: class label 1 specified in weight is not found
warning: class label 1 specified in weight is not found


def BaggingClassifierSVM(X_train,y):
    n_estimators = 10
    subsample_train=2000
    X_train=X_train[::subsample_train,:]
    y=y[::subsample_train,:]
    clf = OneVsRestClassifier(BaggingClassifier(SVC(kernel='linear', probability=True, class_weight='auto'), max_samples=1.0 / n_estimators, n_estimators=n_estimators))
    clf.fit(X_train,y)
    return clf