我正在尝试使用以下代码生成用于分类模型的数据集:
from sklearn.datasets import make_classificationimport matplotlib.pyplot as pltX, y = make_classification(n_features=2)plt.plot(X, y)plt.show()
但这返回了错误:
raise ValueError(“Number of informative, redundant and repeated”)ValueError: 信息性、冗余和重复特征的数量之和必须小于总特征数
回答:
from sklearn.datasets import make_classificationimport matplotlib.pyplot as pltX, y = make_classification(n_features=2, n_informative=1, n_redundant=0, n_classes=1)plt.plot(X,y)plt.show()