我收到下一个警告:D:\Programming\Python\ML\venv\lib\site-packages\sklearn\utils\deprecation.py:77: DeprecationWarning: Function make_blobs is deprecated; Please import make_blobs directly from scikit-learnwarnings.warn(msg, category=DeprecationWarning)即使有了这个from sklearn.datasets.samples_generator import make_blobs还有我的简单代码# generate datasetX, y = mglearn.datasets.make_forge()# plot datasetmglearn.discrete_scatter(X[:, 0], X[:, 1], y)plt.legend(["Class 0", "Class 1"], loc=4)plt.xlabel("First feature")plt.ylabel("Second feature")print("X.shape: {}".format(X.shape))plt.show()函数 make_forge()def make_forge():# a carefully hand-designed dataset lolX, y = make_blobs(centers=2, random_state=4, n_samples=30)y[np.array([7, 27])] = 0mask = np.ones(len(X), dtype=np.bool)mask[np.array([0, 1, 5, 26])] = 0X, y = X[mask], y[mask]return X, y嗯,在make_blobs.py我发现下一件事@deprecated("Please import make_blobs directly from scikit-learn")def make_blobs(n_samples=100, n_features=2, centers=2, cluster_std=1.0, center_box=(-10.0, 10.0), shuffle=True, random_state=None):是的,我知道即使有这个警告,我的代码也会成功编译,但我想知道为什么我会得到这个以及为什么这被弃用了。
添加回答
举报
0/150
提交
取消