Skip to main content

Day 14 – Hyperparameter Tuning with GridSearchCV & RandomizedSearchCV

Published 2 min readMarkdown

Hey everyone πŸ‘‹ Dhairya here,

Today I took another big step in ML by learning hyperparameter tuning. After evaluating models with cross-validation, I realized that picking the right hyperparameters is just as important as choosing the model itself.


πŸ”’ What I Learned Today

1. What are Hyperparameters?

  • Parameters set before training (not learned from data).

  • Examples:

    • Logistic Regression β†’ C (regularization strength)

    • Decision Tree β†’ max_depth, min_samples_split

    • Random Forest β†’ n_estimators


2. GridSearchCV

  • Exhaustively tests all combinations of hyperparameters.

  • Ensures best possible model, but can be computationally expensive.


3. RandomizedSearchCV

  • Tests only a random subset of hyperparameter combinations.

  • Much faster for large search spaces.


4. Practical Example

  • Tuned a Decision Tree Classifier using both methods.

  • Compared results to see which combination of parameters improved accuracy.


🌱 Reflections

Today was eye-opening because I realized default models are rarely the best.
Tuning hyperparameters can drastically improve performance, but you also need to balance time vs accuracy (GridSearch vs RandomizedSearch).


πŸ’» Notebook

My Day 14 notebook is available here πŸ‘‰ GitHub Link – Day 14 Notebook


πŸ“š Resources

πŸŽ₯ YouTube

🌐 Websites


🎯 What’s Next?

For Day 15, I’ll explore Ensemble Methods (Bagging, Random Forest, Boosting).

See you tomorrow πŸ‘‹
β€” Dhairya

About the author

  • I'm a student, trying to find experience and develop skills, and I want to log that journey here. πŸ˜€πŸ‘Š

No comments yet. Be the first to comment.