亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

從 scikit-learn 導入 make_blobs

從 scikit-learn 導入 make_blobs

開心每一天1111 2021-08-14 17:26:31
我收到下一個警告: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):是的,我知道即使有這個警告,我的代碼也會成功編譯,但我想知道為什么我會得到這個以及為什么這被棄用了。
查看完整描述

2 回答

?
千萬里不及你

TA貢獻1784條經驗 獲得超9個贊

  1. 導入 make_blob: from sklearn.datasets import make_blobs

  2. 用這一行替換X, y = mglearn.datasets.make_forge()這一行:X,y = make_blobs()

  3. 運行你的程序


查看完整回答
反對 回復 2021-08-14
?
鳳凰求蠱

TA貢獻1825條經驗 獲得超4個贊

使用以下導入make_blobs不會給您任何警告。

from sklearn.datasets import make_blobs


查看完整回答
反對 回復 2021-08-14
  • 2 回答
  • 0 關注
  • 693 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號