make_hastie_10_2#

sklearn.datasets.make_hastie_10_2(n_samples=12000, *, random_state=None)[原始碼]#

產生 Hastie et al. 2009, 範例 10.2 中使用的二元分類資料。

十個特徵是標準獨立高斯分佈,目標 y 由以下定義

y[i] = 1 if np.sum(X[i] ** 2) > 9.34 else -1

使用者指南中閱讀更多資訊。

參數:
n_samplesint, default=12000

樣本數量。

random_stateint, RandomState 實例或 None, default=None

決定資料集建立的隨機數生成。傳遞 int 以便在多個函數呼叫中獲得可重現的輸出。參見 詞彙表

返回:
X形狀為 (n_samples, 10) 的 ndarray

輸入樣本。

y形狀為 (n_samples,) 的 ndarray

輸出值。

此資料集方法的概括。

[1]

參考文獻

範例

>>> from sklearn.datasets import make_hastie_10_2
>>> X, y = make_hastie_10_2(n_samples=24000, random_state=42)
>>> X.shape
(24000, 10)
>>> y.shape
(24000,)
>>> list(y[:5])
[np.float64(-1.0), np.float64(1.0), np.float64(-1.0), np.float64(1.0),
np.float64(-1.0)]
在 cross_val_score 和 GridSearchCV 上展示多指標評估 (Demonstration of multi-metric evaluation on cross_val_score and GridSearchCV)