Loading topic
LinearRegression model on synthetic data and checks that it recovers the line that generated the data. It assumes you know basic Python, NumPy array shapes, and the equation of a line. It also assumes you have seen the fit and predict pattern from the previous chapter.2 min readLinearRegression and call predict, and that you know NumPy array shapes. By the end you will split data correctly and understand why the split matters.2 min readLinearRegression, split data with train_test_split, and read NumPy arrays. A fitted model needs a number that says how wrong its predictions are. Each metric below summarizes the gap between actual values y and predictions ŷ.2 min readLinearRegression and use a pandas DataFrame. After fit, the model stores what it learned in two attributes. coef_ holds one weight per feature, and intercept_ holds the constant term b in y = Xw + b. The trailing underscore is scikit-learn's convention 2 min readLinearRegression, split data with train_test_split, and compute RMSE, MAE and R-squared. A good score can still hide a model that is wrong in a systematic way. Residuals show you that.2 min readLinearRegression, split data with train_test_split, and read coef_. It covers why feature scale matters, how StandardScaler works, and the most common mistake when using it.2 min readLinearRegression, split data with train_test_split, and scale features with StandardScaler. It shows how a Pipeline chains those steps into one estimator and why that prevents data leakage.2 min readLinearRegression, split data with train_test_split, compute R-squared and RMSE, and build a Pipeline with a scaler. It covers why one split gives a noisy score and how cross_val_score gives a steadier one.2 min readLinearRegression, build a Pipeline, and explain why scaling is fitted on training data only. It covers how to feed a table that has both numbers and category labels into one linear model.2 min readLinearRegression, split data with train_test_split, and read R-squared on a test set from earlier chapters.2 min readLinearRegression, read coef_, and score a model on held-out data. It also assumes you know what a bootstrap resample is: a random sample of rows drawn with replacement.2 min readLinearRegression, build a Pipeline with StandardScaler, and read cross-validated scores. It also assumes you know why plain least squares overfits when features are many or correlated.2 min readRidge model, build a Pipeline, and run cross_val_score. Ridge has one setting you choose yourself, alpha. Settings like this are called hyperparameters. Here you will pick alpha from the training data only.2 min readLinearRegression, read coef_, build a Pipeline, and know why Ridge needs scaled inputs. Here you will fit curved data with a linear model.2 min read