# 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.

Input:

def create_model(units):
model = Sequential() # defining model
model.add(Conv1D(filters = 64, kernel_size = 5, activation = 'relu', input_shape = (max_sensor_length, SENSORS))) # first convolution layer
model.add(MaxPool1D(pool_size = 8)) # first pooling layer
model.add(Conv1D(filters = 16, kernel_size = 5, activation = 'relu')) # 2. layer
model.add(Conv1D(filters = 16, kernel_size = 5, activation = 'relu')) # 3. layer
model.add(Dense(units = units, activation = 'relu'))
model.compile(loss = 'categorical_crossentropy',
metrics = ['accuracy'],
) # compiling the model
return model

model = KerasRegressor(model = create_model, units = 5)

batch_size = [5, 10, 30, 50, 100]
epochs = [5, 10, 30, 50, 100]
units = [5, 10, 15, 30, 50, 100]

param_grid = dict(batch_size = batch_size,
epochs = epochs,
units = units)

grid = GridSearchCV(estimator = model,
param_grid = param_grid,
n_jobs = -1,
cv = 3,
verbose = 10
)

grid_result = grid.fit(X_train,
Y_train,
validation_data = (X_test, Y_test)
)

• Try to remove "n_jobs = -1" from the parameters Nov 9, 2022 at 12:16

From the sklearn documentation on gridsearchCV

verbose (int) Controls the verbosity: the higher, the more messages.

1 : the computation time for each fold and parameter candidate is displayed;

2 : the score is also displayed;

3 : the fold and candidate parameter indexes are also displayed together with the starting time of the computation.

Just set verbose = 1 in the gridsearch parameters (not sure if 10 works?)

Probably you will regret this later as you will end up with a wall of text.

If you are talking about a progress bar for the CNN I would look at tqdm