2

I'm training a FastText word-representation model, and I'm performing a grid search over a range of multiple parameters. Below is multiple parameter lists:

wordNgrams = [2, 3, 4, 5]
lr = [10e-2, 10e-3, 10e-4, 10e-5, 10e-6]
dim = [200, 250, 300]
ws = [5, 6, 8, 10]

I'd like to try every possible combination for the above lists together and pass them as parameters to train my model. I don't know how to implement a python function to do that and was hoping for some help. Please help.

Sam
  • 641
  • 1
  • 7
  • 17

2 Answers2

3

IIUC use itertools:

from itertools import product
print(product(wordNgrams, lr, dim, ws,repeat=4))
U13-Forward
  • 69,221
  • 14
  • 89
  • 114
0

You could also use ParameterGrid from sklearn.model_selection. Explained better in answer to a similar question here.

Xichan
  • 95
  • 1
  • 11