生成Friedman #1数据集#
- sklearn.datasets.make_friedman1(n_samples=100, n_features=10, *, noise=0.0, random_state=None)[source]#
- 生成“Friedman #1”回归问题。 - 该数据集在 Friedman [1] 和 Breiman [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。 - 更多信息请阅读用户指南。 - 参数:
- n_samplesint, 默认值=100
- 样本数量。 
- n_featuresint, 默认值=10
- 特征数量。应至少为5。 
- noisefloat, 默认值=0.0
- 应用于输出的高斯噪声的标准差。 
- random_stateint, RandomState 实例或 None, 默认值=None
- 确定数据集噪声的随机数生成。传递一个整数以在多次函数调用中获得可重复的输出。参见词汇表。 
 
- 返回:
- X形状为 (n_samples, n_features) 的ndarray
- 输入样本。 
- y形状为 (n_samples,) 的ndarray
- 输出值。 
 
 - 参考文献 [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...)] 
