make_friedman2#
- sklearn.datasets.make_friedman2(n_samples=100, *, noise=0.0, random_state=None)[源代码]#
生成“弗里德曼#2”回归问题。
该数据集在Friedman [1] 和布莱曼 [2] .
输入
X
是均匀分布在间隔上的4个独立特征:0 <= X[:, 0] <= 100, 40 * pi <= X[:, 1] <= 560 * pi, 0 <= X[:, 2] <= 1, 1 <= X[:, 3] <= 11.
输出
y
根据公式创建::y(X) = (X[:, 0] ** 2 + (X[:, 1] * X[:, 2] - 1 / (X[:, 1] * X[:, 3])) ** 2) ** 0.5 + noise * N(0, 1).
阅读更多的 User Guide .
- 参数:
- n_samplesint,默认=100
样本数量。
- noisefloat,默认=0.0
The standard deviation of the gaussian noise applied to the output.
- random_stateint,RandomState实例或无,默认=无
确定数据集噪音的随机数生成。传递int以获得跨多个函数调用的可重复输出。看到 Glossary .
- 返回:
- X形状的nd数组(n_samples,4)
输入样本。
- 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_friedman2 >>> X, y = make_friedman2(random_state=42) >>> X.shape (100, 4) >>> y.shape (100,) >>> list(y[:3]) [np.float64(1229.4...), np.float64(27.0...), np.float64(65.6...)]