|
12 | 12 | from emotion_recognition import EmotionRecognizer |
13 | 13 | from parameters import classification_grid_parameters, regression_grid_parameters |
14 | 14 |
|
| 15 | +# emotion classes you want to perform grid search on |
15 | 16 | emotions = ['sad', 'neutral', 'happy'] |
| 17 | +# number of parallel jobs during the grid search |
| 18 | +n_jobs = 4 |
16 | 19 |
|
17 | 20 | best_estimators = [] |
18 | 21 |
|
|
23 | 26 | params['n_neighbors'] = [len(emotions)] |
24 | 27 | d = EmotionRecognizer(model, emotions=emotions) |
25 | 28 | d.load_data() |
26 | | - best_estimator, best_params, cv_best_score = d.grid_search(params=params) |
| 29 | + best_estimator, best_params, cv_best_score = d.grid_search(params=params, n_jobs=n_jobs) |
27 | 30 | best_estimators.append((best_estimator, best_params, cv_best_score)) |
28 | 31 | print(f"{emotions} {best_estimator.__class__.__name__} achieved {cv_best_score:.3f} cross validation accuracy score!") |
29 | 32 |
|
|
39 | 42 | params['n_neighbors'] = [len(emotions)] |
40 | 43 | d = EmotionRecognizer(model, emotions=emotions, classification=False) |
41 | 44 | d.load_data() |
42 | | - best_estimator, best_params, cv_best_score = d.grid_search(params=params) |
| 45 | + best_estimator, best_params, cv_best_score = d.grid_search(params=params, n_jobs=n_jobs) |
43 | 46 | best_estimators.append((best_estimator, best_params, cv_best_score)) |
44 | 47 | print(f"{emotions} {best_estimator.__class__.__name__} achieved {cv_best_score:.3f} cross validation MAE score!") |
45 | 48 |
|
|
0 commit comments