Questions tagged [gridsearchcv]

The tag has no usage guidance.

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

GridSearchCV with TimeSeriesSplit

I am tuning the HPs for a time dependant neural network model (heating energy consumption prediction) in a bachelor thesis. Total amount of samples is 145.860, with minutely granularity from January ...
Anna Clara Dottaviano Morelli's user avatar
0 votes
1 answer
21 views

How to pass a Dataframe as train dataframe and another dataframe as Validation to GridSearchCV

I'm a programmer who tries to find he's way into ML world. so the Question might be basic. i have data from years 2010-2019. Now i'm trying to test different parameters on gradient boosting regression ...
Mostafa Bouzari's user avatar
1 vote
1 answer
53 views

integration of Feature Selection in Pipeline

I have noticed integrating feature selection in a pipeline alters results. Pipeline 1 gives slightly different results with pipeline 2. Why should this be so? Pipeline 2 ...
wwnde's user avatar
  • 113
0 votes
0 answers
43 views

Need insights in how to reduce overfitting with MLPClassifier

I am new to data science. Please bear with me as I ask this long question. I am trying to do Speech Emotion Recognition with MLPCLassifier on RAVDESS and Crema datasets. I am predicting only three ...
tirednemo's user avatar
0 votes
1 answer
159 views

GridSearchCV custom scorer to consider both train and test performance

Based on my current understanding, the standard use of GridSearchCV scorers ( through available options such as "f1_micro") aim to maximize the average performance across validation folds. ...
Enk9456's user avatar
  • 93
1 vote
1 answer
81 views

Can I fit a model with the parameters found with RandomizedSearchCV?

I want to ask you a question. Suppose I use the following RandomizedSearchCV to find the model's best hyperparams: ...
Flavio Brienza's user avatar
0 votes
1 answer
225 views

Tuned model has higher CV accuracy, but a lower test accuracy. Should I use the tuned or untuned model?

I am working on a classification problem using Sci Kit Learn and am confused on how to properly tune hyper parameters to get the "best" model. Before any tuning, my logistic regression ...
d0dg3r_k1d's user avatar
0 votes
0 answers
124 views

Do we need to check the training score when we use randomizedsearchcv

given a model and a set of parameters, randomizedsearchCV(or gridsearchCV) gives the mean of the best scores from a list of different folds of the datasets. Does the model control for overfitting? I ...
Mehmet Deniz's user avatar
1 vote
1 answer
399 views

Does sklearn perform feature selection within cross validation?

I would like to add a feature selector on my pipeline and use gridsearchcv to tune both the hyperparameters of the selector and the classifier(s). I am wondering if sklearn performs feature selection ...
ado sar's user avatar
  • 181
0 votes
1 answer
186 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
  • 617
0 votes
0 answers
66 views

Output of GridSearchCV

I read the documentation of the GridSearchCV from sklearn. I understand that when we use the fit and the predict, actually we are running them on the best model that GridSearchCV found. But can we use ...
Mina's user avatar
  • 111
0 votes
0 answers
68 views

why when I find the best accuracy for logistic regression then it give me this error (AttributeError: split not found)

after run this code I face the split not found error. ...
Ibad Khan's user avatar
1 vote
1 answer
76 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
1 answer
505 views

Need an example of a custom class whose instance is fed to sklearn Pipeline / make_pipeline to use with GridSearchCV

According to sklearn.pipeline.Pipeline documentation, the class whose instance is a pipeline element should implement fit() and transform(). I managed to create a custom class that has these methods ...
James's user avatar
  • 131
2 votes
0 answers
415 views

random_state on train_test_split() appears to have large effect in performance metrics?

To summarize the problem: I have a data set with ~1450 samples, 19 features and a binary outcome where classes are fairly balanced (0.51 to 0.49). I split the data into a train set and a test set ...
jlnsci's user avatar
  • 31
1 vote
2 answers
581 views

How to perform Grid Search on NLP CRF model

I am trying to perform hyperparameter tuning on sklearn_crfsuite.CRF model. When I try to execute below code, it doesn't give any exception but it probably fails to perform fit. And due to which, if I ...
Raj's user avatar
  • 111
0 votes
1 answer
860 views

Why is gridsearchCV.best_estimator_.score giving me r2_score even if I mentioned MAE as my main scoring metric?

I have a lasso regression model with the following definition : ...
Echo's user avatar
  • 113
-1 votes
2 answers
352 views

gridsearchcv best coefficients do not match well with the perfect line

I wrote a program to find the best combination of coefficients to describe a variable. However, the coefficients from the gridsearchcv do not match well with the expected line. This is a sample of my ...
robin kuntz's user avatar
1 vote
1 answer
296 views

Multiple values for a single parameter in the mlflow run command

How to pass multiple values to each parameter in the mlflow run command? The objective is to pass a dictionary to GridSearchCV as a param_grid to perform cross validation. In my main code, I retrieve ...
Downforu's user avatar
  • 131
1 vote
1 answer
45 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
  • 275
0 votes
1 answer
155 views

Comparing accuracies of Grid Search CV & Randomized Search CV with K-Fold Cross Validation?

Are Grid Search CV & Randomized Search CV always/necessarily supposed to give more accurate results after hyperparameter tuning as compared to K-Fold Cross Validation?
Apoorva's user avatar
  • 275
2 votes
1 answer
1k views

sklearn models Parameter tuning GridSearchCV

Dataframe: ...
SaNa's user avatar
  • 129
0 votes
1 answer
108 views

Does hyperparameter tuning of Decision Tree then use it in Adaboost individually vs Simultaneously yield the same results?

So, my predicament here is as follows, I performed hyperparameter tuning on a standalone Decision Tree classifier, and I got the best results, now comes the turn of Standalone Adaboost, but here is ...
SpaceSloth's user avatar
2 votes
0 answers
1k views

How to pick best model based on Accuracy and Recall in a GridSearchCV when you have already set scoring = custom_scorer?

This is a binary classification problem, I am using a GridSearchCV from Sklearn to find the best model, here is the GridSearch line I am using: ...
SpaceSloth's user avatar
1 vote
1 answer
328 views

n_jobs=-1 or n_jobs=1?

I am confused regarding the n_jobs parameter used in some models and for CV. I know it is used for parallel computing, where it includes the number of processors specified in n_jobs parameter. So if I ...
spectre's user avatar
  • 1,941
-1 votes
2 answers
109 views

What would be a good n_estimators matrix and thus param_grid for this problem?

I am using GridSearchCV for optimising my predictions I am running a fairly large dataset and I am afraid I have not optimised the parameters enough. ...
PyNoob's user avatar
  • 83
0 votes
2 answers
179 views

Can I run this job quicker for GridSearchCV?

I am using GridSearchCV for optimising my predictions and its been 5 hours now that the process is running. I am running a fairly large dataset and I am afraid I ...
PyNoob's user avatar
  • 83
0 votes
1 answer
1k views

Worse performance after Hyperparameter tuning

I first construct a base model (using default parameters) and obtain MAE. ...
spectre's user avatar
  • 1,941
0 votes
1 answer
440 views

Different values of mean absolute error when using GridSearchCV for max_leaf_nodes vs manually optimising max_leaf_nodes

I am trying out hyperparameter tuning vs manually selecting the best parameter (max_leaf_nodes) on a decision tree model with mean absolute error as the scoring. In ...
spectre's user avatar
  • 1,941
2 votes
1 answer
237 views

My own model trained on the full data is better than the best_estimator I get from GridSearchCV with refit=True?

I am using an XGBoost model to classify some data. I have cv splits (train, val) and a separate test set that I never use until the end. I have used GridSearchCV to determine the best parameters and ...
AIforAll's user avatar
2 votes
1 answer
2k views

GridSearchCV and time complexity

So, I was learning and trying to implement a GridSearch. I have a question regarding the following code, which I wrote: ...
Dimitri's user avatar
  • 23
0 votes
1 answer
24 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
4 votes
1 answer
9k views

Why GridSearchCV returns nan?

I am using gridsearchcv to tune the parameters of my model and I also use pipeline and cross-validation. When I run the model to tune the parameter of XGBoost, it returns ...
Amin's user avatar
  • 201
3 votes
1 answer
217 views

Geolocation Based Anomaly Detection in IPs Using Isolation Forest

I'm trying to detect anomalies based on geolocation from IP addresses on a server access log file. I have created two features country and geo_velocity, using the IP address and the timestamp of each ...
Nipun Thennakoon's user avatar
2 votes
1 answer
329 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
  • 93
0 votes
0 answers
198 views

GridSearchCV using pre-defined validation dataset for KerasCNN return Warning about function

I want to use GridSearchCV for search best parameters for my CNN models to detect ECG anomaly. I have two dataframe which defined as train and test datasets, since want to follow previous research, ...
YVS1997's user avatar
  • 113
1 vote
1 answer
125 views

Grid Search Pool Classifiers for Dynamic Classifier Selection Ensembles

I would like to grid search pool classifiers hyper parameter of OLA() ( Overall Local Accuracy ) model from deslib python package. ...
Fabrice BOUCHAREL's user avatar
0 votes
1 answer
932 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
777 views

When using GridSearchCV with regression tree how to interpret mean_test_score?

I am using GridSearchCV to tune hyperparameters of regression decision tree. When I do, I get mean_test_score but I thought it would return mean MSE since it is a regressor. how to interpret ...
haneulkim's user avatar
  • 457
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
0 votes
1 answer
45 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
  • 63
0 votes
0 answers
536 views

Hyper tuning reduce the accuracy score, why?

I have performed hyper tuning grid CV search on KNN model. The actual accuracy score for my KNN was accuracy of 42.31 % without performing hyper tuning. However, after performing hyper tuning, the ...
Mara Bella's user avatar
0 votes
1 answer
751 views

RandomizedSearchCV() not scoring all fits

I'm experiencing an issue with a RandomizedSearchCV grid that is not able to evaluate all of the fits. 50 of the 100 fits I'm calling do not get scored (score=nan), so I'm worried I'm wasting a bunch ...
Nick Bohl's user avatar
0 votes
2 answers
1k views

Error in using sklearn's GridSearchCV on Word2Vec

I am using the sklearn_api of gensim to create an estimator for a Word2vec model to pass it to sklearn's gridsearch . My code is as follows : ...
Bharathi's user avatar
  • 277
2 votes
2 answers
320 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
0 votes
2 answers
575 views

i'm using GridSearchCV to find parameter C for SVC() classifier present in sklearn.svm . I'm not getting the optimal result desired

this is a screenshot of my code. i used abc.best_estimator_ (my GridSearchCV model) to find out best results. As you can see grid has values of C=1 and C=100 along with other values. abc....
yash khanna's user avatar
0 votes
0 answers
655 views

Getting unexpected keyword error in CatBoostRegressor while using GridSearchCV

I am trying to use GridSearchCV on a CatBoostRegressor algorithm, but get some "unexpected keyword" errors on 3 different params (classes_count, auto_class_weights, and bayesian_matrix_reg) ...
Donald S's user avatar
  • 1,899
3 votes
3 answers
3k views

What's the difference between GridSearchCrossValidation score and score on testset?

I'm doing classification using python. I'm using the class GridSearchCV, this class has the attribute best_score_ defined as "Mean cross-validated score of the best_estimator". With this ...
fabianod's user avatar
  • 131
0 votes
2 answers
804 views

Getting lower performance metrics when using GridSearchCV

I have defined an XGBoost model and would like to tune some of its hyperparameters. I am using GridSearchCV to find the best params. However, I also tried to fit the model on the entire training ...
Nodame's user avatar
  • 121
1 vote
3 answers
1k views

How to compute AUC in gridsearchSV (multiclass problem)

I'm working on a multiclass classification problem, comparing results from SVM and Random Forest classificators. I would like to use gridsearchCV for hyperparameters tuning and find that AUC is the ...
okraw's user avatar
  • 13