Lecture 07: Diving into Machine Learning on Big Data
Cross-Validation, Python for Linear Regression, and Support Vector Machines
Reminder as always: Pull the latest code (I probably made some minor updates)
Upcoming schedule
ML in the news
Cross-validation
In my opinion, this is the most important advance in all of Machine Learning from the perspective of an applied economist.
Cross-validation vs model performance
Returning to the complexity tradeoff.
Image source: statquest.org
The complex model is super accurate on the training data.
With new data, the complex model is much worse. Notice that the simple model performs about the same.
Simple model
Complex model
The source of the “sweet spot” in model complexity.
We’re going to prove this to ourselves
Cross-Validation in Scikit Learn
Splitting data and Cross-Validation
We train the model on a second split of the data
Splitting into MANY Splits and Folds
Final model performance analysis
Switch to VS Code
Open machine_learning/Linear_Regression.ipynb