make_friedman1#

sklearn.datasets.make_friedman1(n_samples=100, n_features=10, *, noise=0.0, random_state=None)[源代码]#

生成“弗里德曼#1”回归问题。

该数据集在Friedman [1] 和布莱曼 [2] .

输入 X 是均匀分布在区间上的独立特征 [0, 1] .输出 y 根据公式创建::

y(X) = 10 * sin(pi * X[:, 0] * X[:, 1]) + 20 * (X[:, 2] - 0.5) ** 2 + 10 * X[:, 3] + 5 * X[:, 4] + noise * N(0, 1).

n_features 特征,实际上只有5个用于计算 y .其余功能独立于 y .

特征数量必须>= 5。

阅读更多的 User Guide .

参数:
n_samplesint,默认=100

样本数量。

n_featuresint,默认值=10

功能的数量。至少应该是5。

noisefloat,默认=0.0

The standard deviation of the gaussian noise applied to the output.

random_stateint,RandomState实例或无,默认=无

确定数据集噪音的随机数生成。传递int以获得跨多个函数调用的可重复输出。看到 Glossary .

返回:
X形状的nd数组(n_samples,n_features)

输入样本。

y形状的nd数组(n_samples,)

输出值。

引用

[1]

J. Friedman, "Multivariate adaptive regression splines", The Annals of Statistics 19 (1), pages 1-67, 1991.

[2]

L. Breiman, "Bagging predictors", Machine Learning 24, pages 123-140, 1996.

示例

>>> from sklearn.datasets import make_friedman1
>>> X, y = make_friedman1(random_state=42)
>>> X.shape
(100, 10)
>>> y.shape
(100,)
>>> list(y[:3])
[np.float64(16.8...), np.float64(5.8...), np.float64(9.4...)]