我遇到了一个错误:
ValueError: n_splits=3 cannot be greater than the number of members in each class.
在这一行:
gs_clf_svm = gs_clf_svm.fit(X, y)y.shapeOut[148]: (6,)yOut[149]: array(['Andheri East', 'Goregaon', 'Powai', 'Andheri East', 'Goregaon', 'Powai'], dtype=object)
上面这一行是数据和形状的详细信息。请提供建议
回答:
你的目标变量中每个唯一类别只有2个成员。尝试将n_splits设置为2用于GridSearchCV。或者增加你的数据集大小。