make_line_data
data.make_line_data(n_samples=100, beta_0=0, beta_1=1, sd=1, X_low=-10, X_high=10, random_seed=None)
Generate data for linear regression.
Parameters
Name | Type | Description | Default |
---|---|---|---|
n_samples |
int |
Number of samples to generate. | 100 |
beta_0 |
float |
The true intercept of the linear model. | 0 |
beta_1 |
float |
The true slope of the linear model. | 1 |
sd |
float |
Standard deviation of the normally distributed errors. | 1 |
X_low |
float |
Lower bound for the uniform distribution of X. | -10 |
X_high |
float |
Upper bound for the uniform distribution of X. | 10 |
random_seed |
int |
Seed to control randomness. | None |
Returns
Type | Description |
---|---|
tuple |
A tuple containing the X and y arrays. X is a 2D array with shape (n_samples, 1) and y is a 1D array with shape (n_samples,) . X contains the simulated X values and y contains the corresponding true mean of the linear model with added normally distributed errors. |