From 7447ede152c63b9757d110eb7ff4273c56c3bccd Mon Sep 17 00:00:00 2001 From: Osma Suominen Date: Fri, 11 Feb 2022 15:50:10 +0200 Subject: [PATCH] Add very basic unit test for nn_ensemble hyperopt --- tests/test_backend_nn_ensemble.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tests/test_backend_nn_ensemble.py b/tests/test_backend_nn_ensemble.py index 73dbf4558..a6345f534 100644 --- a/tests/test_backend_nn_ensemble.py +++ b/tests/test_backend_nn_ensemble.py @@ -170,6 +170,17 @@ def test_nn_ensemble_is_trained(app_project): assert nn_ensemble.is_trained +def test_nn_ensemble_hyperopt(app_project, fulltext_corpus): + nn_ensemble_type = annif.backend.get_backend('nn_ensemble') + nn_ensemble = nn_ensemble_type( + backend_id='nn_ensemble', + config_params={'sources': 'dummy-en'}, + project=app_project) + + optimizer = nn_ensemble.get_hp_optimizer(fulltext_corpus, metric='NDCG') + optimizer.optimize(n_trials=2, n_jobs=1, results_file=None) + + def test_nn_ensemble_modification_time(app_project): nn_ensemble_type = annif.backend.get_backend("nn_ensemble") nn_ensemble = nn_ensemble_type(