reset password
Author Message
dtang9
Posts: 52
Posted 15:14 Mar 10, 2020 |

I checked Lec10-Lab3, which used grid = GridSearchCV(my_ANN, param_grid, cv=10, scoring='accuracy'). It doesn't use arrays for batch_size and epochs.

How do I use GridSearch to search in the range of batch_size = [30, 50, 100] , epochs = [10, 15, 20]?

Last edited by dtang9 at 15:18 Mar 10, 2020.
mpourhoma
Posts: 39
Posted 15:38 Mar 10, 2020 |

Of course! :)  In Lab3, I did Grid Search to find the best number of neurons in each layer. In HW2, you have to use the same idea/method to find the best batch_size and epochs!

jarciniega2
Posts: 4
Posted 00:53 Mar 11, 2020 |

change the param grid 


param_grid = dict(hidden_layer_sizes = neuron_number)  

since were  looking for the best  batch_size and epochs instead of number of neurons

Last edited by jarciniega2 at 00:55 Mar 11, 2020.
mpourhoma
Posts: 39
Posted 09:26 Mar 11, 2020 |

Okay, here you go:

batch_size = [30 , 50 , 100 ]
epochs = [10 , 15 , 20]
param_grid = dict(batch_size=batch_size, epochs=epochs)

...

Again, it takes a long time to finish this process. Don't leave it for last minutes ...

dtang9
Posts: 52
Posted 09:29 Mar 11, 2020 |
mpourhoma wrote:

Okay, here you go:

batch_size = [30 , 50 , 100 ]
epochs = [10 , 15 , 20]
param_grid = dict(batch_size=batch_size, epochs=epochs)

...

Again, it takes a long time to finish this process. Don't leave it for last minutes ...

I see, that makes sense because we are looking for the batch_size and epochs.

mpourhoma
Posts: 39
Posted 15:35 Mar 12, 2020 |

By the way, in your grid search you have to use only the training data:

grid.fit(X_train, y_train)

 

dtang9
Posts: 52
Posted 15:49 Mar 12, 2020 |

Got it, thanks.