Code Snippets
This is a running list of code snippets that I find helpful in my daily work, implemented in Python and R.
Machine Learning
- Splitting Data into Train and Test Sets
- Tune Hyperparameters Using Random Search
- Tune Hyperparameters Using Grid Search
- K-Fold Cross Validation
Preprocessing
- Impute Missing Values
- Drop Duplicate Values
- Drop Columns
- Rename Columns in a Pandas DataFrame
- Standardizing/Scaling Features
- Convert date strings into datetime format
Feature Engineering
- Dummy Variables
- Get the Number of Days Between Two Dates
- Extract Month, Year, and Day from Date
- Group by Columns to Create Aggregate Features