Skip to content

Commit

Permalink
update also tests
Browse files Browse the repository at this point in the history
  • Loading branch information
scarlehoff committed Aug 9, 2024
1 parent d4087d5 commit 2afb061
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion n3fit/src/n3fit/tests/test_hyperopt.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Test hyperoptimization features
"""

import json
import pathlib
import shutil
Expand All @@ -14,6 +15,7 @@

from n3fit.hyper_optimization.rewards import HyperLoss
from n3fit.model_gen import generate_pdf_model
from n3fit.vpinterface import N3PDF
from validphys.loader import Loader


Expand Down Expand Up @@ -75,8 +77,9 @@ def test_compute_per_fold_loss(loss_type, replica_statistic, expected_per_fold_l
loss = HyperLoss(loss_type=loss_type, replica_statistic=replica_statistic)

# calculate statistic loss for one specific fold
pdf_object = N3PDF(pdf_model.split_replicas())
predicted_per_fold_loss = loss.compute_loss(
penalties, experimental_loss, pdf_model, experimental_data
penalties, experimental_loss, pdf_object, experimental_data
)

# Assert
Expand Down Expand Up @@ -173,6 +176,7 @@ def test_restart_from_pickle(tmp_path):
assert restart_json[i]['misc']['idxs'] == direct_json[i]['misc']['idxs']
# Note that it doesn't check the final loss of the second trial


@pytest.mark.linux
def test_parallel_hyperopt(tmp_path):
"""Ensure that the parallel implementation of hyperopt with MongoDB works as expected."""
Expand Down

0 comments on commit 2afb061

Please sign in to comment.