make_sparse_uncorrelated#

sklearn.datasets.make_sparse_uncorrelated(n_samples=100, n_features=10, *, random_state=None)[source]#

生成具有稀疏不相关设计的随机回归问题。

此数据集由 Celeux 等人 [1] 描述为

X ~ N(0, 1)
y(X) = X[:, 0] + 2 * X[:, 1] - 2 * X[:, 2] - 1.5 * X[:, 3]

只有前 4 个特征是提供信息的。其余特征是无用的。

用户指南中阅读更多内容。

参数:
n_samplesint, default=100

样本数。

n_featuresint, default=10

特征数量。

random_stateint, RandomState instance or None, default=None

确定数据集创建的随机数生成。传递一个 int 值以在多次函数调用中获得可重现的输出。请参阅词汇表

返回:
Xndarray of shape (n_samples, n_features)

输入样本。

yndarray of shape (n_samples,)

输出值。

References

[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,)