{"id":20435,"date":"2023-05-30T12:14:11","date_gmt":"2023-05-30T06:44:11","guid":{"rendered":"https:\/\/www.mygreatlearning.com\/blog\/gridsearchcv\/"},"modified":"2024-09-25T15:49:21","modified_gmt":"2024-09-25T10:19:21","slug":"gridsearchcv","status":"publish","type":"post","link":"https:\/\/www.mygreatlearning.com\/blog\/gridsearchcv\/","title":{"rendered":"Hyperparameter Tuning with GridSearchCV"},"content":{"rendered":"\n<p>In almost any <a href=\"https:\/\/www.mygreatlearning.com\/blog\/top-machine-learning-projects\/\">Machine Learning project<\/a>, we train different models on the dataset and select the one with the best performance. However, there is room for improvement as we cannot say for sure that this particular model is best for the problem at hand. Hence, our aim is to improve the model in any way possible. One important factor in the performances of these models are their hyperparameters, once we set appropriate values for these hyperparameters, the performance of a model can improve significantly. In this article, we will find out how we can find optimal values for the hyperparameters of a model by using GridSearchCV.<\/p>\n\n\n\n<h2 class=\"wp-block-heading has-very-dark-gray-color has-text-color\" id=\"what-is-gridsearchcv\"><strong>What is GridSearchCV?<\/strong><\/h2>\n\n\n\n<p>GridSearchCV is the process of performing hyperparameter tuning in order to determine the optimal values for a given model. As mentioned above, the performance of a model significantly depends on the value of hyperparameters. Note that there is no way to know in advance the best values for hyperparameters so ideally, we need to try all possible values to know the optimal values. Doing this manually could take a considerable amount of time and resources and thus we use GridSearchCV to automate the tuning of hyperparameters.<br><\/p>\n\n\n\n<p>GridSearchCV is a function that comes in Scikit-learn\u2019s(or SK-learn) model_selection package.So an important point here to note is that we need to have the <a href=\"https:\/\/www.mygreatlearning.com\/academy\/learn-for-free\/courses\/scikit-learn\" target=\"_blank\" rel=\"noreferrer noopener\">Scikit learn<\/a> library installed on the computer. This function helps to loop through predefined hyperparameters and fit your estimator (model) on your training set. So, in the end, we can select the best parameters from the listed hyperparameters.<\/p>\n\n\n\n    <div class=\"courses-cta-container\">\n        <div class=\"courses-cta-card\">\n            <div class=\"courses-cta-header\">\n                <div class=\"courses-learn-icon\"><\/div>\n                <span class=\"courses-learn-text\">Texas McCombs, UT Austin<\/span>\n            <\/div>\n            <p class=\"courses-cta-title\">\n                <a href=\"https:\/\/onlineexeced.mccombs.utexas.edu\/online-data-science-business-analytics-course\" class=\"courses-cta-title-link\">Post Graduate Program in Data Science with Generative AI: Applications to Business<\/a>\n            <\/p>\n            <p class=\"courses-cta-description\">Learn how to turn data into strategy in this UT Data Science and Business Analytics Course \u2014 now with a focus on Generative AI. Gain practical experience through 7 hands-on projects over a 7-month duration.<\/p>\n            <div class=\"courses-cta-stats\">\n                <div class=\"courses-stat-item\">\n                    <div class=\"courses-stat-icon courses-user-icon\"><\/div>\n                    <span>7 Hands-on Projects<\/span>\n                <\/div>\n                <div class=\"courses-stat-item\">\n                    <div class=\"courses-stat-icon courses-star-icon\"><\/div>\n                    <span>Duration: 7 months<\/span>\n                <\/div>\n            <\/div>\n            <a href=\"https:\/\/onlineexeced.mccombs.utexas.edu\/online-data-science-business-analytics-course\" class=\"courses-cta-button\">\n                Discover the Program\n                <div class=\"courses-arrow-icon\"><\/div>\n            <\/a>\n        <\/div>\n    <\/div>\n\n\n\n<p><br><\/p>\n\n\n\n<h2 class=\"wp-block-heading has-very-dark-gray-color has-text-color\" id=\"how-does-gridsearchcv-work\"><strong>How does GridSearchCV work?<\/strong><\/h2>\n\n\n\n<p>As mentioned above, we pass predefined values for hyperparameters to the GridSearchCV function. We do this by defining a dictionary in which we mention a particular hyperparameter along with the values it can take. Here is an example of it<br><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"> { 'C': [0.1, 1, 10, 100, 1000],&nbsp;&nbsp;\n&nbsp;&nbsp;&nbsp;'gamma': [1, 0.1, 0.01, 0.001, 0.0001],&nbsp;\n&nbsp;&nbsp;&nbsp;'kernel': ['rbf',\u2019linear\u2019,'sigmoid']&nbsp; }<\/pre>\n\n\n\n<p>Here C, gamma and kernels are some of the hyperparameters of an SVM model. Note that the rest of the hyperparameters will be set to their default values<\/p>\n\n\n\n<p>GridSearchCV tries all the combinations of the values passed in the dictionary and evaluates the model for each combination using the <a href=\"https:\/\/www.mygreatlearning.com\/blog\/cross-validation\/\" target=\"_blank\" rel=\"noreferrer noopener\" aria-label=\"Cross-Validation (opens in a new tab)\">Cross-Validation<\/a> method. Hence after using this function we get accuracy\/loss for every combination of hyperparameters and we can choose the one with the best performance.<\/p>\n\n\n\n<h2 class=\"wp-block-heading has-very-dark-gray-color has-text-color\" id=\"how-to-use-gridsearchcv\"><strong>How to use GridSearchCV?<\/strong><\/h2>\n\n\n\n<p>In this section, we shall see how to use GridSearchCV and also find out how it improves the performance of the model.<\/p>\n\n\n\n<p>First, let us see what are the various arguments that are taken by GridSearchCV function:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; gutter: false; title: ; notranslate\" title=\"\">\nsklearn.model_selection.GridSearchCV(estimator, param_grid,scoring=None,\n          n_jobs=None, iid=&#039;deprecated&#039;, refit=True, cv=None, verbose=0, \n          pre_dispatch=&#039;2*n_jobs&#039;, error_score=nan, return_train_score=False) \n<\/pre><\/div>\n\n\n<p>We are going to briefly describe a few of these parameters and the rest you can see on the original <a aria-label=\"documentation (opens in a new tab)\" href=\"https:\/\/scikit-learn.org\/stable\/modules\/generated\/sklearn.model_selection.GridSearchCV.html\" target=\"_blank\" rel=\"nofollow noreferrer noopener\">documentation<\/a>:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><strong>1.estimator<\/strong>: Pass the model instance for which you want to check the hyperparameters.\n<strong>2.params_grid<\/strong>: the dictionary object that holds the hyperparameters you want to try\n<strong>3.scoring<\/strong>: evaluation metric that you want to use, you can simply pass a valid string\/ object of evaluation metric\n<strong>4.cv<\/strong>: number of cross-validation you have to try for each selected set of hyperparameters\n<strong>5.verbose<\/strong>: you can set it to 1 to get the detailed print out while you fit the data to GridSearchCV\n<strong>6.n_jobs<\/strong>: number of processes you wish to run in parallel for this task if it -1 it will use all available processors. <\/pre>\n\n\n\n<p>Now, let us see how to use GridSearchCV to improve the accuracy of our model. Here I am going to train the model twice, once without using GridsearchCV(using the default hyperparameters) and the other time we will use GridSearchCV to find the optimal values of hyperparameters for the dataset at hand. I am using the famous <a href=\"https:\/\/archive.ics.uci.edu\/ml\/datasets\/Breast+Cancer+Wisconsin+%28Diagnostic%29\" target=\"_blank\" rel=\"nofollow noreferrer noopener\" aria-label=\"Breast Cancer Wisconsin (Diagnostic) Data Set (opens in a new tab)\">Breast Cancer Wisconsin (Diagnostic) Data Set<\/a> which I am directly importing from the Scikit-learn library here.<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: python; title: ; notranslate\" title=\"\">\n#import all necessary libraries\nimport sklearn\nfrom sklearn.datasets import load_breast_cancer\nfrom sklearn.metrics import classification_report, confusion_matrix \nfrom sklearn.datasets import load_breast_cancer \nfrom sklearn.svm import SVC \nfrom sklearn.model_selection import GridSearchCV\nfrom sklearn.model_selection import train_test_split \n\n#load the dataset and split it into training and testing sets\ndataset = load_breast_cancer()\nX=dataset.data\nY=dataset.target\nX_train, X_test, y_train, y_test = train_test_split( \n                        X,Y,test_size = 0.30, random_state = 101) \n# train the model on train set without using GridSearchCV \nmodel = SVC() \nmodel.fit(X_train, y_train) \n  \n# print prediction results \npredictions = model.predict(X_test) \nprint(classification_report(y_test, predictions)) \n\n<\/pre><\/div>\n\n\n<p><\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; gutter: false; title: ; notranslate\" title=\"\">\nOUTPUT:\n precision    recall  f1-score   support\n\n           0       0.95      0.85      0.90        66\n           1       0.91      0.97      0.94       105\n\n    accuracy                           0.92       171\n   macro avg       0.93      0.91      0.92       171\nweighted avg       0.93      0.92      0.92       171\n<\/pre><\/div>\n\n\n<p><\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: python; first-line: 23; title: ; notranslate\" title=\"\">\n# defining parameter range \nparam_grid = {&#039;C&#039;: &#x5B;0.1, 1, 10, 100],  \n              &#039;gamma&#039;: &#x5B;1, 0.1, 0.01, 0.001, 0.0001], \n              &#039;gamma&#039;:&#x5B;&#039;scale&#039;, &#039;auto&#039;],\n              &#039;kernel&#039;: &#x5B;&#039;linear&#039;]}  \n  \ngrid = GridSearchCV(SVC(), param_grid, refit = True, verbose = 3,n_jobs=-1) \n  \n# fitting the model for grid search \ngrid.fit(X_train, y_train) \n\n# print best parameter after tuning \nprint(grid.best_params_) \ngrid_predictions = grid.predict(X_test) \n  \n# print classification report \nprint(classification_report(y_test, grid_predictions)) \n<\/pre><\/div>\n\n\n<p><\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; first-line: 0; gutter: false; title: ; notranslate\" title=\"\">\nOutput:\n {&#039;C&#039;: 100, &#039;gamma&#039;: &#039;scale&#039;, &#039;kernel&#039;: &#039;linear&#039;}\n              precision    recall  f1-score   support\n\n           0       0.97      0.91      0.94        66\n           1       0.94      0.98      0.96       105\n\n    accuracy                           0.95       171\n   macro avg       0.96      0.95      0.95       171\nweighted avg       0.95      0.95      0.95       171\n<\/pre><\/div>\n\n\n<p>A lot of you might think that <em>{'C': 100, 'gamma': 'scale', 'kernel': 'linear'}<\/em> are the best values for hyperparameters for an SVM model. This is not the case, the above-mentioned hyperparameters may be the best for the dataset we are working on. But for any other dataset, the SVM model can have different optimal values for hyperparameters that may improve its performance.<\/p>\n\n\n\n    <div class=\"courses-cta-container\">\n        <div class=\"courses-cta-card\">\n            <div class=\"courses-cta-header\">\n                <div class=\"courses-learn-icon\"><\/div>\n                <span class=\"courses-learn-text\">Accelerate AI Career<\/span>\n            <\/div>\n            <p class=\"courses-cta-title\">\n                <a href=\"https:\/\/www.mygreatlearning.com\/executive-pgp-ai-machine-learning\" class=\"courses-cta-title-link\">PGP- Artificial Intelligence and Machine Learning (Executive)<\/a>\n            <\/p>\n            <p class=\"courses-cta-description\">Advance your career with cutting-edge AI skills \u2014 built for working professionals.<\/p>\n            <div class=\"courses-cta-stats\">\n                <div class=\"courses-stat-item\">\n                    <div class=\"courses-stat-icon courses-user-icon\"><\/div>\n                    <span>7 months Duration<\/span>\n                <\/div>\n                <div class=\"courses-stat-item\">\n                    <div class=\"courses-stat-icon courses-star-icon\"><\/div>\n                    <span>4.72\/5 Rating<\/span>\n                <\/div>\n            <\/div>\n            <a href=\"https:\/\/www.mygreatlearning.com\/executive-pgp-ai-machine-learning\" class=\"courses-cta-button\">\n                Explore the Course\n                <div class=\"courses-arrow-icon\"><\/div>\n            <\/a>\n        <\/div>\n    <\/div>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"difference-between-parameter-and-hypermeter\"><strong>Difference between parameter and hypermeter&nbsp;<\/strong><\/h2>\n\n\n\n<figure class=\"wp-block-table is-style-stripes\"><table><tbody><tr><td><strong>Parameter&nbsp;<\/strong><\/td><td><strong>Hyperparameter<\/strong><\/td><\/tr><tr><td>The configuration model's parameters are internal to the model.<\/td><td>Hyperparameters are parameters that are explicitly specified and control the training process.<\/td><\/tr><tr><td>Predictions require the use of parameters.<\/td><td>Model optimization necessitates the use of hyperparameters.<\/td><\/tr><tr><td>These are specified or guessed while the model is being trained.<\/td><td>These are established prior to the start of the model's training.<\/td><\/tr><tr><td>This is internal to the model.<\/td><td>This is external to the model.<\/td><\/tr><tr><td>These are learned &amp; set by the model by itself.<\/td><td>These are set manually by a machine learning engineer\/practitioner.<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>When you utilise <a href=\"https:\/\/www.mygreatlearning.com\/blog\/cross-validation\/\" target=\"_blank\" rel=\"noreferrer noopener\">cross-validation<\/a>, you set aside a portion of your data to use in assessing your model. Cross-validation can be done in a variety of ways. The easiest notion is to utilise 70% (I'm making up a number here; it doesn't have to be 70%) of the data for training and the remaining 30% for evaluating the model's performance. To avoid overfitting, you'll need distinct data for training and assessing the model. Other (somewhat more difficult) cross-validation approaches, such as k-fold cross-validation, are also commonly employed in practice.<\/p>\n\n\n\n<p>Grid search is a method for performing hyper-parameter optimisation, that is, with a given model (e.g. a CNN) and test dataset, it is a method for finding the optimal combination of hyper-parameters (an example of a hyper-parameter is the learning rate of the optimiser). You have numerous models in this case, each with a different set of hyper-parameters. Each of these parameter combinations that correspond to a single model is said to lie on a \"grid\" point. The purpose is to train and evaluate each of these models using cross-validation, for example. Then you choose the one that performed the best.<\/p>\n\n\n\n<p>This brings us to the end of this article where we learned how to find optimal hyperparameters of our model to get the best performance out of it. <\/p>\n\n\n\n<p><em>To learn more about this domain, check out Great Learning\u2019s PG Program in Artificial Intelligence and Machine Learning to upskill. This <a href=\"https:\/\/www.mygreatlearning.com\/pg-program-artificial-intelligence-course\" target=\"_blank\" rel=\"noreferrer noopener\">Artificial Intelligence course will help you learn a <\/a>comprehensive curriculum from a top-ranking global school and to build job-ready Artificial Intelligence skills. The program offers a hands-on learning experience with top faculty and dedicated mentor support. On completion, you will receive a Certificate from The University of Texas at Austin.<\/em><\/p>\n\n\n\n<p>To fully understand how to optimize your models using GridSearchCV, building a strong foundation in machine learning is key. Fortunately, there are <em><a href=\"https:\/\/www.mygreatlearning.com\/academy\">free online courses<\/a><\/em> available, which allow you to learn at your own pace and level up your skills.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"further-reading\">Further Reading<\/h2>\n\n\n\n<ol class=\"wp-block-list\">\n<li><a aria-label=\"An Easy Guide to Gradient Descent in Machine Learning (opens in a new tab)\" href=\"https:\/\/www.mygreatlearning.com\/blog\/gradient-descent\/\" target=\"_blank\" rel=\"noreferrer noopener\">An Easy Guide to Gradient Descent in Machine Learning<\/a><\/li>\n\n\n\n<li><a aria-label=\"Support Vector Machine algorithm (SVM) (opens in a new tab)\" href=\"https:\/\/www.mygreatlearning.com\/blog\/introduction-to-support-vector-machine\/\" target=\"_blank\" rel=\"noreferrer noopener\">Support Vector Machine algorithm (SVM)<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/www.mygreatlearning.com\/blog\/what-is-machine-learning\/\">What is Machine Learning?<\/a><\/li>\n\n\n\n<li><a aria-label=\"What is Gradient Boosting and how is it different from AdaBoost (opens in a new tab)\" href=\"https:\/\/www.mygreatlearning.com\/blog\/gradient-boosting\/\" target=\"_blank\" rel=\"noreferrer noopener\">What is Gradient Boosting and how is it different from AdaBoost<\/a><\/li>\n\n\n\n<li><a aria-label=\"Understanding the Ensemble method Bagging and Boosting (opens in a new tab)\" href=\"https:\/\/www.mygreatlearning.com\/blog\/bagging-boosting\/\" target=\"_blank\" rel=\"noreferrer noopener\">Understanding the Ensemble method Bagging and Boosting<\/a><\/li>\n\n\n\n<li><a aria-label=\"What is Cross Validation in Machine learning?  (opens in a new tab)\" href=\"https:\/\/www.mygreatlearning.com\/blog\/cross-validation\/\" target=\"_blank\" rel=\"noreferrer noopener\">What is Cross Validation in Machine learning? <\/a><\/li>\n<\/ol>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"gridsearchcv-faqs\"><strong>GridSearchCV FAQs<\/strong><\/h2>\n\n\n\n<div class=\"schema-faq wp-block-yoast-faq-block\"><div class=\"schema-faq-section\" id=\"faq-question-1655089919390\"><strong class=\"schema-faq-question\">What is GridSearchCV used for?<\/strong> <p class=\"schema-faq-answer\">GridSearchCV is a technique for finding the optimal parameter values from a given set of parameters in a grid. It's essentially a cross-validation technique. The model as well as the parameters must be entered. After extracting the best parameter values, predictions are made.<\/p> <\/div> <div class=\"schema-faq-section\" id=\"faq-question-1655089929793\"><strong class=\"schema-faq-question\">How do you define GridSearchCV?<\/strong> <p class=\"schema-faq-answer\">\u00a0GridSearchCV is the process of performing hyperparameter tuning in order to determine the optimal values for a given model.<\/p> <\/div> <div class=\"schema-faq-section\" id=\"faq-question-1655089943107\"><strong class=\"schema-faq-question\">What does cv in GridSearchCV stand for?<\/strong> <p class=\"schema-faq-answer\">GridSearchCV is also known as GridSearch cross-validation: an internal cross-validation technique is used to calculate the score for each combination of parameters on the grid.<\/p> <\/div> <div class=\"schema-faq-section\" id=\"faq-question-1655089956778\"><strong class=\"schema-faq-question\">How do you use GridSearchCV in regression?<\/strong> <p class=\"schema-faq-answer\">GirdserachCV in regression can be used by following the below steps<br\/>Import the library - GridSearchCv.<br\/>Set up the Data.<br\/>Model and its Parameter.<br\/>Using GridSearchCV and Printing Results.<br\/><\/p> <\/div> <div class=\"schema-faq-section\" id=\"faq-question-1655089970910\"><strong class=\"schema-faq-question\">Does GridSearchCV use cross-validation?<\/strong> <p class=\"schema-faq-answer\">GridSearchCV does, in fact, do cross-validation. If I understand the notion correctly, you want to hide a portion of your data set from the model so that it may be tested. As a result, you train your models on training data and then test them on testing data.<\/p> <\/div> <\/div>\n","protected":false},"excerpt":{"rendered":"<p>In almost any Machine Learning project, we train different models on the dataset and select the one with the best performance. However, there is room for improvement as we cannot say for sure that this particular model is best for the problem at hand. Hence, our aim is to improve the model in any way [&hellip;]<\/p>\n","protected":false},"author":41,"featured_media":20455,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"_uag_custom_page_level_css":"","site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"set","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"categories":[2],"tags":[],"content_type":[],"class_list":["post-20435","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-artificial-intelligence"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v27.3 (Yoast SEO v27.3) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>An Introduction to GridSearchCV | What is Grid Search | Great Learning<\/title>\n<meta name=\"description\" content=\"GridSearchCV is a function that comes in Scikit-learn\u2019s model_selection package to find the best values for hyperparameters of a model.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.mygreatlearning.com\/blog\/gridsearchcv\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Hyperparameter Tuning with GridSearchCV\" \/>\n<meta property=\"og:description\" content=\"GridSearchCV is a function that comes in Scikit-learn\u2019s model_selection package to find the best values for hyperparameters of a model.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.mygreatlearning.com\/blog\/gridsearchcv\/\" \/>\n<meta property=\"og:site_name\" content=\"Great Learning Blog: Free Resources what Matters to shape your Career!\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/GreatLearningOfficial\/\" \/>\n<meta property=\"article:published_time\" content=\"2023-05-30T06:44:11+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-09-25T10:19:21+00:00\" \/>\n<meta property=\"og:image\" content=\"http:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2020\/09\/shutterstock_400597261.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1000\" \/>\n\t<meta property=\"og:image:height\" content=\"664\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Great Learning Editorial Team\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@https:\/\/twitter.com\/Great_Learning\" \/>\n<meta name=\"twitter:site\" content=\"@Great_Learning\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Great Learning Editorial Team\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"6 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/gridsearchcv\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/gridsearchcv\\\/\"},\"author\":{\"name\":\"Great Learning Editorial Team\",\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/#\\\/schema\\\/person\\\/6f993d1be4c584a335951e836f2656ad\"},\"headline\":\"Hyperparameter Tuning with GridSearchCV\",\"datePublished\":\"2023-05-30T06:44:11+00:00\",\"dateModified\":\"2024-09-25T10:19:21+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/gridsearchcv\\\/\"},\"wordCount\":1258,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/gridsearchcv\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/09\\\/shutterstock_400597261.jpg\",\"articleSection\":[\"AI and Machine Learning\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/gridsearchcv\\\/#respond\"]}]},{\"@type\":[\"WebPage\",\"FAQPage\"],\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/gridsearchcv\\\/\",\"url\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/gridsearchcv\\\/\",\"name\":\"An Introduction to GridSearchCV | What is Grid Search | Great Learning\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/gridsearchcv\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/gridsearchcv\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/09\\\/shutterstock_400597261.jpg\",\"datePublished\":\"2023-05-30T06:44:11+00:00\",\"dateModified\":\"2024-09-25T10:19:21+00:00\",\"description\":\"GridSearchCV is a function that comes in Scikit-learn\u2019s model_selection package to find the best values for hyperparameters of a model.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/gridsearchcv\\\/#breadcrumb\"},\"mainEntity\":[{\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/gridsearchcv\\\/#faq-question-1655089919390\"},{\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/gridsearchcv\\\/#faq-question-1655089929793\"},{\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/gridsearchcv\\\/#faq-question-1655089943107\"},{\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/gridsearchcv\\\/#faq-question-1655089956778\"},{\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/gridsearchcv\\\/#faq-question-1655089970910\"}],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/gridsearchcv\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/gridsearchcv\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/09\\\/shutterstock_400597261.jpg\",\"contentUrl\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/09\\\/shutterstock_400597261.jpg\",\"width\":1000,\"height\":664,\"caption\":\"gridsearchcv\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/gridsearchcv\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Blog\",\"item\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"AI and Machine Learning\",\"item\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/artificial-intelligence\\\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Hyperparameter Tuning with GridSearchCV\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/\",\"name\":\"Great Learning Blog\",\"description\":\"Learn, Upskill &amp; Career Development Guide and Resources\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/#organization\"},\"alternateName\":\"Great Learning\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/#organization\",\"name\":\"Great Learning\",\"url\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/06\\\/GL-Logo.jpg\",\"contentUrl\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/06\\\/GL-Logo.jpg\",\"width\":900,\"height\":900,\"caption\":\"Great Learning\"},\"image\":{\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/GreatLearningOfficial\\\/\",\"https:\\\/\\\/x.com\\\/Great_Learning\",\"https:\\\/\\\/www.instagram.com\\\/greatlearningofficial\\\/\",\"https:\\\/\\\/www.linkedin.com\\\/school\\\/great-learning\\\/\",\"https:\\\/\\\/in.pinterest.com\\\/greatlearning12\\\/\",\"https:\\\/\\\/www.youtube.com\\\/user\\\/beaconelearning\\\/\"],\"description\":\"Great Learning is a leading global ed-tech company for professional training and higher education. It offers comprehensive, industry-relevant, hands-on learning programs across various business, technology, and interdisciplinary domains driving the digital economy. These programs are developed and offered in collaboration with the world's foremost academic institutions.\",\"email\":\"info@mygreatlearning.com\",\"legalName\":\"Great Learning Education Services Pvt. Ltd\",\"foundingDate\":\"2013-11-29\",\"numberOfEmployees\":{\"@type\":\"QuantitativeValue\",\"minValue\":\"1001\",\"maxValue\":\"5000\"}},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/#\\\/schema\\\/person\\\/6f993d1be4c584a335951e836f2656ad\",\"name\":\"Great Learning Editorial Team\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/02\\\/unnamed.webp\",\"url\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/02\\\/unnamed.webp\",\"contentUrl\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/02\\\/unnamed.webp\",\"caption\":\"Great Learning Editorial Team\"},\"description\":\"The Great Learning Editorial Staff includes a dynamic team of subject matter experts, instructors, and education professionals who combine their deep industry knowledge with innovative teaching methods. Their mission is to provide learners with the skills and insights needed to excel in their careers, whether through upskilling, reskilling, or transitioning into new fields.\",\"sameAs\":[\"https:\\\/\\\/www.mygreatlearning.com\\\/\",\"https:\\\/\\\/in.linkedin.com\\\/school\\\/great-learning\\\/\",\"https:\\\/\\\/x.com\\\/https:\\\/\\\/twitter.com\\\/Great_Learning\",\"https:\\\/\\\/www.youtube.com\\\/channel\\\/UCObs0kLIrDjX2LLSybqNaEA\"],\"award\":[\"Best EdTech Company of the Year 2024\",\"Education Economictimes Outstanding Education\\\/Edtech Solution Provider of the Year 2024\",\"Leading E-learning Platform 2024\"],\"url\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/author\\\/greatlearning\\\/\"},{\"@type\":\"Question\",\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/gridsearchcv\\\/#faq-question-1655089919390\",\"position\":1,\"url\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/gridsearchcv\\\/#faq-question-1655089919390\",\"name\":\"What is GridSearchCV used for?\",\"answerCount\":1,\"acceptedAnswer\":{\"@type\":\"Answer\",\"text\":\"GridSearchCV is a technique for finding the optimal parameter values from a given set of parameters in a grid. It's essentially a cross-validation technique. The model as well as the parameters must be entered. After extracting the best parameter values, predictions are made.\",\"inLanguage\":\"en-US\"},\"inLanguage\":\"en-US\"},{\"@type\":\"Question\",\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/gridsearchcv\\\/#faq-question-1655089929793\",\"position\":2,\"url\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/gridsearchcv\\\/#faq-question-1655089929793\",\"name\":\"How do you define GridSearchCV?\",\"answerCount\":1,\"acceptedAnswer\":{\"@type\":\"Answer\",\"text\":\"\u00a0GridSearchCV is the process of performing hyperparameter tuning in order to determine the optimal values for a given model.\",\"inLanguage\":\"en-US\"},\"inLanguage\":\"en-US\"},{\"@type\":\"Question\",\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/gridsearchcv\\\/#faq-question-1655089943107\",\"position\":3,\"url\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/gridsearchcv\\\/#faq-question-1655089943107\",\"name\":\"What does cv in GridSearchCV stand for?\",\"answerCount\":1,\"acceptedAnswer\":{\"@type\":\"Answer\",\"text\":\"GridSearchCV is also known as GridSearch cross-validation: an internal cross-validation technique is used to calculate the score for each combination of parameters on the grid.\",\"inLanguage\":\"en-US\"},\"inLanguage\":\"en-US\"},{\"@type\":\"Question\",\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/gridsearchcv\\\/#faq-question-1655089956778\",\"position\":4,\"url\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/gridsearchcv\\\/#faq-question-1655089956778\",\"name\":\"How do you use GridSearchCV in regression?\",\"answerCount\":1,\"acceptedAnswer\":{\"@type\":\"Answer\",\"text\":\"GirdserachCV in regression can be used by following the below stepsu003cbr\\\/u003eImport the library - GridSearchCv.u003cbr\\\/u003eSet up the Data.u003cbr\\\/u003eModel and its Parameter.u003cbr\\\/u003eUsing GridSearchCV and Printing Results.u003cbr\\\/u003e\",\"inLanguage\":\"en-US\"},\"inLanguage\":\"en-US\"},{\"@type\":\"Question\",\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/gridsearchcv\\\/#faq-question-1655089970910\",\"position\":5,\"url\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/gridsearchcv\\\/#faq-question-1655089970910\",\"name\":\"Does GridSearchCV use cross-validation?\",\"answerCount\":1,\"acceptedAnswer\":{\"@type\":\"Answer\",\"text\":\"GridSearchCV does, in fact, do cross-validation. If I understand the notion correctly, you want to hide a portion of your data set from the model so that it may be tested. As a result, you train your models on training data and then test them on testing data.\",\"inLanguage\":\"en-US\"},\"inLanguage\":\"en-US\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"An Introduction to GridSearchCV | What is Grid Search | Great Learning","description":"GridSearchCV is a function that comes in Scikit-learn\u2019s model_selection package to find the best values for hyperparameters of a model.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.mygreatlearning.com\/blog\/gridsearchcv\/","og_locale":"en_US","og_type":"article","og_title":"Hyperparameter Tuning with GridSearchCV","og_description":"GridSearchCV is a function that comes in Scikit-learn\u2019s model_selection package to find the best values for hyperparameters of a model.","og_url":"https:\/\/www.mygreatlearning.com\/blog\/gridsearchcv\/","og_site_name":"Great Learning Blog: Free Resources what Matters to shape your Career!","article_publisher":"https:\/\/www.facebook.com\/GreatLearningOfficial\/","article_published_time":"2023-05-30T06:44:11+00:00","article_modified_time":"2024-09-25T10:19:21+00:00","og_image":[{"width":1000,"height":664,"url":"http:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2020\/09\/shutterstock_400597261.jpg","type":"image\/jpeg"}],"author":"Great Learning Editorial Team","twitter_card":"summary_large_image","twitter_creator":"@https:\/\/twitter.com\/Great_Learning","twitter_site":"@Great_Learning","twitter_misc":{"Written by":"Great Learning Editorial Team","Est. reading time":"6 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.mygreatlearning.com\/blog\/gridsearchcv\/#article","isPartOf":{"@id":"https:\/\/www.mygreatlearning.com\/blog\/gridsearchcv\/"},"author":{"name":"Great Learning Editorial Team","@id":"https:\/\/www.mygreatlearning.com\/blog\/#\/schema\/person\/6f993d1be4c584a335951e836f2656ad"},"headline":"Hyperparameter Tuning with GridSearchCV","datePublished":"2023-05-30T06:44:11+00:00","dateModified":"2024-09-25T10:19:21+00:00","mainEntityOfPage":{"@id":"https:\/\/www.mygreatlearning.com\/blog\/gridsearchcv\/"},"wordCount":1258,"commentCount":0,"publisher":{"@id":"https:\/\/www.mygreatlearning.com\/blog\/#organization"},"image":{"@id":"https:\/\/www.mygreatlearning.com\/blog\/gridsearchcv\/#primaryimage"},"thumbnailUrl":"https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2020\/09\/shutterstock_400597261.jpg","articleSection":["AI and Machine Learning"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.mygreatlearning.com\/blog\/gridsearchcv\/#respond"]}]},{"@type":["WebPage","FAQPage"],"@id":"https:\/\/www.mygreatlearning.com\/blog\/gridsearchcv\/","url":"https:\/\/www.mygreatlearning.com\/blog\/gridsearchcv\/","name":"An Introduction to GridSearchCV | What is Grid Search | Great Learning","isPartOf":{"@id":"https:\/\/www.mygreatlearning.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.mygreatlearning.com\/blog\/gridsearchcv\/#primaryimage"},"image":{"@id":"https:\/\/www.mygreatlearning.com\/blog\/gridsearchcv\/#primaryimage"},"thumbnailUrl":"https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2020\/09\/shutterstock_400597261.jpg","datePublished":"2023-05-30T06:44:11+00:00","dateModified":"2024-09-25T10:19:21+00:00","description":"GridSearchCV is a function that comes in Scikit-learn\u2019s model_selection package to find the best values for hyperparameters of a model.","breadcrumb":{"@id":"https:\/\/www.mygreatlearning.com\/blog\/gridsearchcv\/#breadcrumb"},"mainEntity":[{"@id":"https:\/\/www.mygreatlearning.com\/blog\/gridsearchcv\/#faq-question-1655089919390"},{"@id":"https:\/\/www.mygreatlearning.com\/blog\/gridsearchcv\/#faq-question-1655089929793"},{"@id":"https:\/\/www.mygreatlearning.com\/blog\/gridsearchcv\/#faq-question-1655089943107"},{"@id":"https:\/\/www.mygreatlearning.com\/blog\/gridsearchcv\/#faq-question-1655089956778"},{"@id":"https:\/\/www.mygreatlearning.com\/blog\/gridsearchcv\/#faq-question-1655089970910"}],"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.mygreatlearning.com\/blog\/gridsearchcv\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.mygreatlearning.com\/blog\/gridsearchcv\/#primaryimage","url":"https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2020\/09\/shutterstock_400597261.jpg","contentUrl":"https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2020\/09\/shutterstock_400597261.jpg","width":1000,"height":664,"caption":"gridsearchcv"},{"@type":"BreadcrumbList","@id":"https:\/\/www.mygreatlearning.com\/blog\/gridsearchcv\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Blog","item":"https:\/\/www.mygreatlearning.com\/blog\/"},{"@type":"ListItem","position":2,"name":"AI and Machine Learning","item":"https:\/\/www.mygreatlearning.com\/blog\/artificial-intelligence\/"},{"@type":"ListItem","position":3,"name":"Hyperparameter Tuning with GridSearchCV"}]},{"@type":"WebSite","@id":"https:\/\/www.mygreatlearning.com\/blog\/#website","url":"https:\/\/www.mygreatlearning.com\/blog\/","name":"Great Learning Blog","description":"Learn, Upskill &amp; Career Development Guide and Resources","publisher":{"@id":"https:\/\/www.mygreatlearning.com\/blog\/#organization"},"alternateName":"Great Learning","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.mygreatlearning.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.mygreatlearning.com\/blog\/#organization","name":"Great Learning","url":"https:\/\/www.mygreatlearning.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.mygreatlearning.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2022\/06\/GL-Logo.jpg","contentUrl":"https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2022\/06\/GL-Logo.jpg","width":900,"height":900,"caption":"Great Learning"},"image":{"@id":"https:\/\/www.mygreatlearning.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/GreatLearningOfficial\/","https:\/\/x.com\/Great_Learning","https:\/\/www.instagram.com\/greatlearningofficial\/","https:\/\/www.linkedin.com\/school\/great-learning\/","https:\/\/in.pinterest.com\/greatlearning12\/","https:\/\/www.youtube.com\/user\/beaconelearning\/"],"description":"Great Learning is a leading global ed-tech company for professional training and higher education. It offers comprehensive, industry-relevant, hands-on learning programs across various business, technology, and interdisciplinary domains driving the digital economy. These programs are developed and offered in collaboration with the world's foremost academic institutions.","email":"info@mygreatlearning.com","legalName":"Great Learning Education Services Pvt. Ltd","foundingDate":"2013-11-29","numberOfEmployees":{"@type":"QuantitativeValue","minValue":"1001","maxValue":"5000"}},{"@type":"Person","@id":"https:\/\/www.mygreatlearning.com\/blog\/#\/schema\/person\/6f993d1be4c584a335951e836f2656ad","name":"Great Learning Editorial Team","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2022\/02\/unnamed.webp","url":"https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2022\/02\/unnamed.webp","contentUrl":"https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2022\/02\/unnamed.webp","caption":"Great Learning Editorial Team"},"description":"The Great Learning Editorial Staff includes a dynamic team of subject matter experts, instructors, and education professionals who combine their deep industry knowledge with innovative teaching methods. Their mission is to provide learners with the skills and insights needed to excel in their careers, whether through upskilling, reskilling, or transitioning into new fields.","sameAs":["https:\/\/www.mygreatlearning.com\/","https:\/\/in.linkedin.com\/school\/great-learning\/","https:\/\/x.com\/https:\/\/twitter.com\/Great_Learning","https:\/\/www.youtube.com\/channel\/UCObs0kLIrDjX2LLSybqNaEA"],"award":["Best EdTech Company of the Year 2024","Education Economictimes Outstanding Education\/Edtech Solution Provider of the Year 2024","Leading E-learning Platform 2024"],"url":"https:\/\/www.mygreatlearning.com\/blog\/author\/greatlearning\/"},{"@type":"Question","@id":"https:\/\/www.mygreatlearning.com\/blog\/gridsearchcv\/#faq-question-1655089919390","position":1,"url":"https:\/\/www.mygreatlearning.com\/blog\/gridsearchcv\/#faq-question-1655089919390","name":"What is GridSearchCV used for?","answerCount":1,"acceptedAnswer":{"@type":"Answer","text":"GridSearchCV is a technique for finding the optimal parameter values from a given set of parameters in a grid. It's essentially a cross-validation technique. The model as well as the parameters must be entered. After extracting the best parameter values, predictions are made.","inLanguage":"en-US"},"inLanguage":"en-US"},{"@type":"Question","@id":"https:\/\/www.mygreatlearning.com\/blog\/gridsearchcv\/#faq-question-1655089929793","position":2,"url":"https:\/\/www.mygreatlearning.com\/blog\/gridsearchcv\/#faq-question-1655089929793","name":"How do you define GridSearchCV?","answerCount":1,"acceptedAnswer":{"@type":"Answer","text":"\u00a0GridSearchCV is the process of performing hyperparameter tuning in order to determine the optimal values for a given model.","inLanguage":"en-US"},"inLanguage":"en-US"},{"@type":"Question","@id":"https:\/\/www.mygreatlearning.com\/blog\/gridsearchcv\/#faq-question-1655089943107","position":3,"url":"https:\/\/www.mygreatlearning.com\/blog\/gridsearchcv\/#faq-question-1655089943107","name":"What does cv in GridSearchCV stand for?","answerCount":1,"acceptedAnswer":{"@type":"Answer","text":"GridSearchCV is also known as GridSearch cross-validation: an internal cross-validation technique is used to calculate the score for each combination of parameters on the grid.","inLanguage":"en-US"},"inLanguage":"en-US"},{"@type":"Question","@id":"https:\/\/www.mygreatlearning.com\/blog\/gridsearchcv\/#faq-question-1655089956778","position":4,"url":"https:\/\/www.mygreatlearning.com\/blog\/gridsearchcv\/#faq-question-1655089956778","name":"How do you use GridSearchCV in regression?","answerCount":1,"acceptedAnswer":{"@type":"Answer","text":"GirdserachCV in regression can be used by following the below stepsu003cbr\/u003eImport the library - GridSearchCv.u003cbr\/u003eSet up the Data.u003cbr\/u003eModel and its Parameter.u003cbr\/u003eUsing GridSearchCV and Printing Results.u003cbr\/u003e","inLanguage":"en-US"},"inLanguage":"en-US"},{"@type":"Question","@id":"https:\/\/www.mygreatlearning.com\/blog\/gridsearchcv\/#faq-question-1655089970910","position":5,"url":"https:\/\/www.mygreatlearning.com\/blog\/gridsearchcv\/#faq-question-1655089970910","name":"Does GridSearchCV use cross-validation?","answerCount":1,"acceptedAnswer":{"@type":"Answer","text":"GridSearchCV does, in fact, do cross-validation. If I understand the notion correctly, you want to hide a portion of your data set from the model so that it may be tested. As a result, you train your models on training data and then test them on testing data.","inLanguage":"en-US"},"inLanguage":"en-US"}]}},"uagb_featured_image_src":{"full":["https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2020\/09\/shutterstock_400597261.jpg",1000,664,false],"thumbnail":["https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2020\/09\/shutterstock_400597261-150x150.jpg",150,150,true],"medium":["https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2020\/09\/shutterstock_400597261-300x199.jpg",300,199,true],"medium_large":["https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2020\/09\/shutterstock_400597261-768x510.jpg",768,510,true],"large":["https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2020\/09\/shutterstock_400597261.jpg",1000,664,false],"1536x1536":["https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2020\/09\/shutterstock_400597261.jpg",1000,664,false],"2048x2048":["https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2020\/09\/shutterstock_400597261.jpg",1000,664,false],"web-stories-poster-portrait":["https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2020\/09\/shutterstock_400597261.jpg",640,425,false],"web-stories-publisher-logo":["https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2020\/09\/shutterstock_400597261.jpg",96,64,false],"web-stories-thumbnail":["https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2020\/09\/shutterstock_400597261.jpg",150,100,false]},"uagb_author_info":{"display_name":"Great Learning Editorial Team","author_link":"https:\/\/www.mygreatlearning.com\/blog\/author\/greatlearning\/"},"uagb_comment_info":0,"uagb_excerpt":"In almost any Machine Learning project, we train different models on the dataset and select the one with the best performance. However, there is room for improvement as we cannot say for sure that this particular model is best for the problem at hand. Hence, our aim is to improve the model in any way&hellip;","_links":{"self":[{"href":"https:\/\/www.mygreatlearning.com\/blog\/wp-json\/wp\/v2\/posts\/20435","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.mygreatlearning.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.mygreatlearning.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.mygreatlearning.com\/blog\/wp-json\/wp\/v2\/users\/41"}],"replies":[{"embeddable":true,"href":"https:\/\/www.mygreatlearning.com\/blog\/wp-json\/wp\/v2\/comments?post=20435"}],"version-history":[{"count":52,"href":"https:\/\/www.mygreatlearning.com\/blog\/wp-json\/wp\/v2\/posts\/20435\/revisions"}],"predecessor-version":[{"id":110748,"href":"https:\/\/www.mygreatlearning.com\/blog\/wp-json\/wp\/v2\/posts\/20435\/revisions\/110748"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.mygreatlearning.com\/blog\/wp-json\/wp\/v2\/media\/20455"}],"wp:attachment":[{"href":"https:\/\/www.mygreatlearning.com\/blog\/wp-json\/wp\/v2\/media?parent=20435"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.mygreatlearning.com\/blog\/wp-json\/wp\/v2\/categories?post=20435"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.mygreatlearning.com\/blog\/wp-json\/wp\/v2\/tags?post=20435"},{"taxonomy":"content_type","embeddable":true,"href":"https:\/\/www.mygreatlearning.com\/blog\/wp-json\/wp\/v2\/content_type?post=20435"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}