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.

114 questions
11
votes
2 answers

What is the most efficient method for hyperparameter optimization in scikit-learn?

An overview of the hyperparameter optimization process in scikit-learn is here. Exhaustive grid search will find the optimal set of hyperparameters for a model. The downside is that exhaustive grid search is slow. Random search is faster than grid…
10
votes
4 answers

Log loss vs accuracy for deciding between different learning rates?

While model tuning using cross validation and grid search I was plotting the graph of different learning rate against log loss and accuracy separately. Log loss When I used log loss as score in grid search to identify the best learning rate out of…
10
votes
3 answers

How to estimate GridSearchCV computing time?

If I know the time of a given validation with set values, can I estimate the time GridSearchCV will take for n values I want to cross-validate?
Nathan Furnal
  • 265
  • 1
  • 3
  • 10
9
votes
1 answer

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 when I don't define a metric or list of metrics?
TwoPointNo
  • 91
  • 1
  • 2
7
votes
1 answer

how to pass parameters over sklearn pipeline's stages?

I'm working on a deep neural model for text classification using Keras. To fine tune some hyperparameters i'm using Keras Wrappers for the Scikit-Learn API. So I builded a Sklearn Pipeline for that: def create_model(optimizer="adam",…
7
votes
1 answer

How to plot mean_test score and mean_train score of GridSearchCV

How to plot mean_train_score and mean_test_score values in GridSearchCV for C and gamma values of SVM?
Harika M
  • 345
  • 1
  • 4
  • 7
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…
5
votes
5 answers

GridSearch without CV

I create a Random Forest and Gradient Boosting Regressor by using GridSearchCV. For the Gradient Boosting Regressor, it takes too long for me. But I need to know which are the best parameters for the models. So I am thinking if there is a GridSearch…
ml_learner
  • 347
  • 1
  • 4
  • 11
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
  • 400
  • 1
  • 4
  • 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 Gagarin
  • 171
  • 1
  • 5
4
votes
2 answers

Why is cross-validation score so low?

I am using Scikit-Learn for this classification problem. The dataset has 3 features and 600 data points with labels. First I used Nearest Neighbor classifier. Instead of using cross-validation, I manually run the fit 5 times and everytime resplit…
ddd
  • 203
  • 1
  • 2
  • 6
4
votes
1 answer

Grid seach is unavailable for Keras in case of multiple outputs?

I do experiments with the following Keras architecture with multiple outputs: def create_model(conv_kernels = 32, dense_nodes = 512): model_input=Input(shape=(img_channels, img_rows, img_cols)) x = Convolution2D(conv_kernels, (3, 3), padding…
Hendrik
  • 8,377
  • 17
  • 40
  • 55
3
votes
2 answers

How plot GridSearch results?

I trained an SVM model with GridSearch svc = SVC() parameters = { 'kernel': ['linear', 'rbf'], 'C': [0.1, 1, 10] } cv = GridSearchCV(svc, parameters, cv=5) cv.fit(v_train, y_train) print_results(cv) Here is the result I got: BEST PARAMS:…
AziZ
  • 149
  • 1
  • 3
3
votes
0 answers

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 test set with a proportion of 80%-20%): y_train…
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
  • 131
  • 1
  • 2
1
2 3 4 5 6 7 8