Skip to main content

Questions tagged [grid-search]

In machine learning, grid search refers to multiple runs to find the optimal value of parameter(s)/hyperparameter(s) of a model, e.g. mtry for random-forest or alpha, beta, lambda for glm, or C, kernel and gamma for SVM.

Filter by
Sorted by
Tagged with
0 votes
0 answers
4 views

What is the standard ML pipeline for training and testing?

I have a dataframe containing 1324 rows and 28 columns and I'm kinda lost on which approach to go for when training regression models. Currently I perform a data split and run GridSearchCV to pick the ...
Davi Magalhães's user avatar
0 votes
1 answer
22 views

Sklearn EstimatorCV vs GridSearchCV

sklearn has the following description for EstimatorCV estimators: https://scikit-learn.org/stable/glossary.html#term-cross-validation-estimator An estimator that has built-in cross-validation ...
wannabedatascientist's user avatar
0 votes
1 answer
92 views

Test Error is extremely higher than Training error after gridsearch and crossvalidation

I'm currently working on a machine learning project. It's a supervised learning problem. My goal is to predict for given data of an animal(keeping,size,weight,...) ingredients(energy,vitamine etc..). ...
Marco Cotrotzo's user avatar
1 vote
1 answer
41 views

How are the successive sets of training samples that are allocated for each iteration of HalvingGridSearchCV determined?

The scikit-learn classes HalvingGridSearchCV and HalvingRandomSearchCV implement a hyperparameter tuning method known as successive halving. It is an iterative selection process in which all the ...
Evan Aad's user avatar
  • 185
0 votes
0 answers
87 views

Hot-encoding warning when using gridsearch

I ran an experiment with the classical holdout method to predict price and hot-encoded categorical data. However, when optimising, I got the warning below even though that I ignored the unknown ...
Aze 's user avatar
  • 1
0 votes
0 answers
38 views

Plot binary logloss of LightGBM

I implemented Gridsearch for a LightGBM, predicting a binary outcome with 33 features. ...
Nima Yousefi's user avatar
0 votes
1 answer
39 views

Cross validation and train_test_split

I am building a class that follows the workflow: Model Selection and Fitting The class accepts a list of models and their respective hyperparameter grids. It then performs a standard fitting process ...
Guilherme Raibolt's user avatar
0 votes
1 answer
456 views

Can I use GridSearchCV.best_score_ for evaluation of model performance?

Scikit-learn page on Grid Search says: Model selection by evaluating various parameter settings can be seen as a way to use the labeled data to “train” the parameters of the grid. When evaluating the ...
Charlie's user avatar
  • 103
2 votes
0 answers
1k views

How to do grid search for Catboost with categorical_cols

I know it's easy to do grid search for a simple Catboost model, such as in here: https://medium.com/aiplusoau/hyperparameter-tuning-a5fe69d2a6c7 by running something like ...
Ian's user avatar
  • 21
1 vote
2 answers
607 views

RandomizedSearchcv(n_iter=10) doesnt stop after training 10 models

I am using RandomizedSearchcv for hyperparameter optimization. When I run the model, it shows the scores for each model training. The problem is, it trains way more than 10 models when in fact I ...
Mehmet Deniz's user avatar
0 votes
1 answer
66 views

Question about grid search and KFold

I am trying an example which I am training on a huge dataset 5M (only 4 features) rows with Cudf and CUml and I am using SGD logistic regression because I must predict if the patient if is sick or not ...
gkasap's user avatar
  • 1
1 vote
1 answer
501 views

How to determine which combinations of parameters to include in GridSearchCV

I am using MLPClassifier from sklearn and I would like to tune it with GridSearchCV. But I don't know which set of values to include for hidden_layer_sizes, max_iter, activation, solver, etc. How can ...
Penjan's user avatar
  • 11
0 votes
1 answer
279 views

How does GridSearchCV use Cross Validation to produce a Model's Score?

I understand Cross Validation in practice, but I'm not sure how SciKit-Learn's GridSearchCV uses it to produce an overall score/ metric for a model. For example, if ...
Connor's user avatar
  • 671
2 votes
2 answers
2k views

Grid_search (RandomizedSearchCV) extremely slow with SVM (SVC)

I'm testing hyperparameters for an SVM, however, when I resort to Gridsearch or RandomizedSearchCV, I haven't been able to get a resolution, because the processing time is exceeding hours. My dataset ...
Paulo Sergio Moreira's user avatar
0 votes
1 answer
121 views

HalvingGridSearchCV

Is there a way to get Feature importance from sklearn`s HalvingGridSearchCV? For example: Is there any way to access the feature importance? Please help me up. Thanks!
Sanket's user avatar
  • 1
2 votes
1 answer
2k views

Can GridSearchCV be used for unsupervised learning?

im trying to build an outlier detector to find outliers in test data. That data varies a bit (more test channels, longer/shorter testing). First im applying the train test split because i want to use ...
arooki's user avatar
  • 23
0 votes
0 answers
136 views

Apply GridSearchCV for two algorithms having common hyperparameters

I am working on a regression task and using a Stacking regressor model. ...
Ankit Seth's user avatar
  • 1,821
1 vote
1 answer
775 views

Grid-search for a multi-output regression task using Scikit-learn's API

I'm trying to make a model for a multi-output regression task where $y=(y_1, y_2,..., y_n)$ is a vector rather than a single scalar. I am using Scikit-learn's ...
Hassan Abedi's user avatar
0 votes
2 answers
7k views

progress bar for GridSearchCV

I am building CNN algorithm that will output some values. I am using GridSearchCV for parameters tuning and I want to implement progress bar for handling with large datasets but I do not know how to. ...
leskovecg98's user avatar
1 vote
1 answer
201 views

Grid Searching seed in randomized machine learning

I was wondering if tuning a seed with cross-validation in order to maximize the performance of an algorithm heavily based on a randomness factor is a good idea or not. I have created an Extra Tree ...
Jonathan's user avatar
0 votes
0 answers
60 views

Implementation/Optimization of Genetic Algorithm

I have a few queries regarding my implementation of the Genetic Algorithm (GA). I have a lot of parameters in which I have to find the best combination of these parameters to maximize the value of the ...
ashwin ram kumar's user avatar
1 vote
1 answer
110 views

Random search grid not displaying scoring metric

I want to do a grid search of some few hyperparameters through a XGBClassifier of a binary class, but whenever i run it the score value (roc_auc) is not being ...
Lucas Dresl's user avatar
1 vote
1 answer
123 views

Brute-force feature selection and cross-validation

There is an existing score made of 10 parameters; each parameter is equally weighted & the total score is found by summing the score for each parameter. I want to try to reduce the number of ...
NotLost's user avatar
  • 11
0 votes
2 answers
2k views

Gridsearch ValueError: Input contains infinity or a value too large for dtype('float64'). - Using Pipeline

Update: I have non NAN values so fillna is not an issue. Clean dataset. I'm having this error occur when I try to predict using my grid best params. I get a score when fit it onto the training data. I ...
Dove's user avatar
  • 11
2 votes
1 answer
459 views

Fashion MNIST: Is there an easy way to extract only 1% of the data to do a minimal gridsearch?

I am trying implement several models on the fashion-MNIST. I have imported the data according to the tf.keras tutorial: ...
ilam engl's user avatar
  • 121
0 votes
1 answer
952 views

How to loop through multiple lists/dict?

I have the following code which finds the best value of k parameter in the KNNImputer. Basically it is looping through the list ...
spectre's user avatar
  • 2,165
1 vote
3 answers
2k views

GridSearch CV: Suitable scoring metrics for Imbalanced data sets

I am new to machine learning. This is my $1^{st}$ machine learning project and I am working on classification on an imbalanced dataset. There are also multi-classes in the target variable. I would ...
Peter's user avatar
  • 179
2 votes
1 answer
48 views

Query regarding surprising spike in accuracy of ML model

I implemented all the major ML models (Logistic Regression, Naive Bayes, SVM, KNN, Decision Tree, Random Forest, Ada Boost & XGBoost) on my dataset. My stratified cross-validation scores are ...
Apoorva's user avatar
  • 317
0 votes
2 answers
94 views

GridSeachCV not performing well on ML models

...
Parth Sharma's user avatar
0 votes
1 answer
1k views

Why does Light GBM model produce different results while testing?

Using the Light GBM regressor, I have trained my data and, using Grid Search, I got the best parameters, but while testing with the best parameters I am getting different results each time, which ...
HEMANTHKUMAR GADI's user avatar
0 votes
1 answer
179 views

Is Cross validation and GridSearchCV required every time we train a model?

I have a repetitive process that will build a model weekly based on the previous week's data. So while in development I tried GridSearchCV and cross-validation to ...
ro23's user avatar
  • 35
0 votes
1 answer
569 views

Using BERT for search engine with an Elastic Database

I want to make Documents search engine where the user will type a query and top n relevant documents should be shown. I want to use BERT for the searching and the first question is can i use it with ...
Mohy Mohamed's user avatar
0 votes
1 answer
26 views

Specifying parameter grid for regression model

I am working with more than one dataset. So, I have to test my Random Forest Model over 4 datasets. The parameter grid I am taking for dataset D1 is not producing good results for dataset D2 and so on....
Swarnima's user avatar
11 votes
1 answer
8k views

What's the default Scorer in Sci-kit learn's GridSearchCV?

Even if I don't define the scoring parameter, it scores and makes a decision for best estimator, but documentation says the default value for scoring is "None", so what is it using to score ...
TwoPointNo's user avatar
0 votes
1 answer
224 views

GridSearchCV Decrease performance RF

Can Gridsearchcv params perform worst than default RF? RF with default values performs rmse_train=4886,r^2_train=0.84, ...
simo954's user avatar
  • 13
0 votes
0 answers
882 views

sklearn gridsearch lasso regression: find specific number of coefficients

I am using GridSearchCV and Lasso regression in order to fit a dataset composed out of Gaussians. I keep this example similar to this tutorial. My goal is to find the best solution with a restricted ...
Felix's user avatar
  • 1
2 votes
1 answer
359 views

GridSearchCV with custom tune grid

What is the best way to perform custom parameter search CV with the Scikit-learn API? I really like GridSearchCV. However for my case the param_grid parameter is ...
Enk9456's user avatar
  • 105
0 votes
1 answer
2k views

Understand RandomizedSearchCV output

I am trying to do hyperparameter tunning for the Randomforest regression model. I'm using RandomizedSearchCV (scikit-learn) and I defined verbose=10. For that reason, I'm getting messaged while it's ...
Reut's user avatar
  • 299
0 votes
2 answers
447 views

using simple autoencoder for feature selection

I am using a simple autoencoder to extract the informative features and I have multiple Q: I know that the features extracted will be a linear combination of the original features so I consider that ...
Andrew Moba's user avatar
3 votes
2 answers
5k views

How plot GridSearch results?

I trained an SVM model with GridSearch ...
AziZ's user avatar
  • 149
0 votes
1 answer
1k views

Does GridSearchCV not save the best parameters?

So I tuned the hyperparameters using GridSearchCV, fitted the model to the data, and then used best_params_. I'm just curious ...
srp's user avatar
  • 3
1 vote
1 answer
357 views

small dataset CV

I have a very small dataset ( 150 records) with 20 features, trying to predict a binary outcome. Due to the small size, i chose to do 10 CV instead of train/test as the train/test split. I was ...
XPeriment's user avatar
0 votes
1 answer
3k views

How to refit GridSearchCV on Multiclass problem

I'm trying to use GridSearchCV for my Multiclass problem. For starters, wanted to test it on KNeighborsClassifier. First, here's the code where I define the function which uses GridSearchCV: ...
Deniz's user avatar
  • 1
2 votes
0 answers
2k views

how to set gridsearchCV to ignore the errors

I want to use GridSearchCV in Python for my Logistic Regression model, and i want it to check combinations for every possible setting, but i get an error when there is time for penalty: l1 and solver ...
Pleban's user avatar
  • 31
2 votes
1 answer
2k views

how to prevent machine crash while searching for hyper parameters of XGBoost with GridSearchCV

I am searching for best hyper parameters of XGBRegressor using GridSearchCV. Here is the code: ...
Naveen Reddy Marthala's user avatar
0 votes
1 answer
880 views

SKLEARN GridSearchCV hinting higher accuracy than Pipeline but with same parameters as Pipeline estimators

I have pipeline estimators like this: ...
luky's user avatar
  • 133
0 votes
1 answer
47 views

GridSearchCV Acting Weird [duplicate]

I am using GridSearchCV to find the best combination of parameters for SVM. However, the parameters chosen by GridSeasrchCV do not seem to be the best ones. I tried some parameters randomly and they ...
moii789's user avatar
  • 73
3 votes
0 answers
148 views

Initial value space for Random Forest hyperparameter tuning

I'm building a Random Forest Classifier using Scikit Learn. My problem consists in a 4 class classification task, the values are distributed as follows (after splitting my data in training set and ...
Mattia Surricchio's user avatar
1 vote
0 answers
187 views

xgboost calibration kde plots (isotonic) not smooth

i am training my xgboost model on an imbalanced binary classification problem. It is important to me to have well calibrated probabilities so i have chosen to optimize the brier score. I then plot the ...
Maths12's user avatar
  • 526
2 votes
2 answers
510 views

Faster grid search with small dataset to derive best params instead of full dataset?

I have a dataset of 300 000 rows and an ensemble model, which include grid search to find the best params of every algorithm. Unfortunately the grid search needs to long and I have problems to ...
martin's user avatar
  • 329