建立稀疏非相關資料 (make_sparse_uncorrelated)#
- sklearn.datasets.make_sparse_uncorrelated(n_samples=100, n_features=10, *, random_state=None)[原始碼]#
產生具有稀疏非相關設計的隨機迴歸問題。
此資料集在 Celeux 等人 [1] 中描述為
X ~ N(0, 1) y(X) = X[:, 0] + 2 * X[:, 1] - 2 * X[:, 2] - 1.5 * X[:, 3]
只有前 4 個特徵具有資訊性。 其餘特徵無用。
在使用者指南中閱讀更多資訊。
- 參數:
- n_samplesint,預設值 = 100
樣本數量。
- n_featuresint,預設值 = 10
特徵數量。
- random_stateint、RandomState 實例或 None,預設為 None
決定資料集建立時的隨機數生成。傳遞一個整數以在多次函數調用中獲得可重複的輸出。請參閱 詞彙表。
- 回傳值:
- X形狀為 (n_samples, n_features) 的 ndarray
輸入樣本。
- y形狀為 (n_samples,) 的 ndarray
輸出值。
參考文獻
[1]G. Celeux, M. El Anbari, J.-M. Marin, C. P. Robert, “Regularization in regression: comparing Bayesian and frequentist methods in a poorly informative situation”, 2009.
範例
>>> from sklearn.datasets import make_sparse_uncorrelated >>> X, y = make_sparse_uncorrelated(random_state=0) >>> X.shape (100, 10) >>> y.shape (100,)