Questions tagged [gridsearchcv]
89 questions
10
votes
2 answers
Parameters in GridSearchCV in scikit-learn
I am trying to build a model in scikit-learn. I used RandomForestClassifier as my method for classification. In order to improve the score and efficiency of my model, I thought about using GridSearchCV.
Here is the code:
import pandas as pd
import…
enterML
- 3,091
- 9
- 28
- 38
9
votes
3 answers
How to combine GridSearchCV with Early Stopping?
I'm a beginner in machine learning and want to train a CNN (for image recognition) with optimized hyperparameter like dropout rate, learning rate and number of epochs.
The optimal hyperparameter I try to find via GridSearchCV from Scikit-learn.
I…
Code Now
- 403
- 1
- 6
- 11
9
votes
1 answer
What is GridSearchCV doing after it finishes evaluating the performance of parameter combinations that takes so long?
I'm running GridSearchCV to tune some parameters. For example:
params = {
'max_depth':[18,21]
}
gscv = GridSearchCV(
xgbc,
params,
scoring='roc_auc',
verbose=50,
cv=StratifiedKFold(n_splits=2,…
Dan Scally
- 1,784
- 8
- 26
6
votes
1 answer
Is GridSearchCV in combination with ImageDataGenerator possible and recommendable?
I want to optimize some hyperparameters for a CNN architecture by using GridSearchCV (Scikit-Learn) in combination with Data Augmentation (ImageDataGenerator from Keras).
However, GridSearchCV only offers the fit function and not the fit_generator…
Code Now
- 403
- 1
- 6
- 11
5
votes
1 answer
Search for hyperparameters whith different features using Random Forest
I have a dataset in which I would like to perform a classification model, so I have decided to use Random Forest. The number of features that I have is approximately 200 and I would like to test which set of features gives me a better result. For…
Lila
- 227
- 2
- 7
4
votes
2 answers
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 nan. However, when I use the same code for other classifiers like random…
Aaron
- 231
- 1
- 3
- 9
4
votes
1 answer
How is the GridsearchCV Score calculated?
How is the score of GridsearchCV calculated? Is the score a percentage? Does this mean higher is a better?
ml_learner
- 357
- 1
- 5
- 11
4
votes
2 answers
Is it alright to split a GridSearchCV?
Is it ok to split a GridsearchCV?
At first, I would try estimators from 100-300 (100 steps) for a random forest regressor and some other parameters and after that, I would start the GridsearchCV with the same parameter and just change the estimators…
ml_learner
- 357
- 1
- 5
- 11
4
votes
1 answer
How to cache GridSearchCV optimizer result in Google Colab?
I have to execute GridSearchCV() cell every time I reload the page and it takes a lot of time. Is there a caching mechanism which stores the GridSearchCV result so that I can use it without executing the cell on the reload?
Code:
neigh_clf =…
Dibakor Barua
- 43
- 3
4
votes
1 answer
How to get mean test scores from GridSearchCV with multiple scorers - scikit-learn
I'm trying to get mean test scores from scikit-learn's GridSearchCV with multiple scorers.
grid.cv_results_ displays lots of info. But
grid.cv_results_['mean_test_score'] keeps giving me an error.
I've checked the docs and similar questions with…
jeffhale
- 410
- 1
- 5
- 9
4
votes
4 answers
Default parameters for decision trees give better results than parameters optimised using GridsearchCV
I am using Gridsearch for a DecisionTreeClassifier predicting a binary outcome. When I run fit and predict with default parameters, I get the following results:
Accuracy: 0.9602242115860793
F1: 0.9581087077004674
Then I try GridsearchCV:
from…
Ilia Slobodchikov
- 171
- 2
- 5
3
votes
1 answer
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 request. However, since all the requests are from…
Nipun Thennakoon
- 133
- 5
3
votes
3 answers
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 class i can also compute the score over the test set using…
fabianod
- 141
- 1
- 3
3
votes
1 answer
Do i need to use hyperparamters from Gridsearch to train on WHOLE training set to get final model?
I just want to make sure i am on the right lines so please correct me if wrong. I am testing which hyperparmets are best for logisitic regession on my data X, y where X is featrues and y is target. X, y are made from my training set. I also have a…
Maths12
- 546
- 6
- 16
3
votes
2 answers
How to implement gridsearchCV for onevsrestclassifier of LogisticRegression classifier?
parameters = [{'C': [10**-2, 10**-1, 10**0,10**1, 10**2, 10**3]}]
model_tunning = GridSearchCV(OneVsRestClassifier(LogisticRegression(penalty='l1')), param_grid=parameters,scoring="f1")
model_tunning.fit(x_train_multilabel, y_train)
ValueError …
Satyam Kumar
- 31
- 1
- 3