
上QQ阅读APP看书,第一时间看更新
Creating a regression dataset
- First, the stalwart—regression:
reg_data = d.make_regression()
By default, this will generate a tuple with a 100 x 100 matrix—100 samples by 100 features. However, by default, only 10 features are responsible for the target data generation. The second member of the tuple is the target variable. It is also possible to get more involved in generating data for regression.
- For example, to generate a 1,000 x 10 matrix with five features responsible for the target creation, an underlying bias factor of 1.0, and 2 targets, the following command will be run:
complex_reg_data = d.make_regression(1000, 10, 5, 2, 1.0)
complex_reg_data[0].shape
(1000L, 10L)