【发布时间】:2021-02-27 05:18:15
【问题描述】:
我需要生成一个具有 m 个元组的随机 n 维数据集。前四个维度预计与地面实况向量y相关,其余维度将任意生成。我将使用 Scikit-learn 将数据集用于我的回归任务。如何生成这些数据?
例如: 一个数据集,其中 元组大小(m)=10000 和 维度大小(n)=100
之后,我需要拆分数据集,使随机选择的 70% 元组用于训练,而 30% 元组用于测试。
PS:我在 sci-kit learn 中找到了这段代码,但我不确定我是否可以使用它。如何将其转化为我的问题?
x, y, coef = datasets.make_regression(n_samples=100,#number of samples
n_features=1,#number of features
n_informative=1,#number of useful features
noise=10,#bias and standard deviation of the guassian noise
coef=True,#true coefficient used to generated the data
random_state=0) #set for same data points for each run
【问题讨论】:
标签: python scikit-learn regression