Skip to content

Commit

Permalink
#63 test for different kpis
Browse files Browse the repository at this point in the history
  • Loading branch information
jkriwet committed Nov 11, 2024
1 parent b4a1f89 commit df47550
Showing 1 changed file with 26 additions and 1 deletion.
27 changes: 26 additions & 1 deletion tests/test_data_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ def test_goals(self):
goals = Goals(meas_target_data=meas_target_data,
variable_names=var_names,
statistical_measure="RMSE")

# Check set_sim_target_data:
goals.set_sim_target_data(sim_target_data)

Expand All @@ -83,6 +82,32 @@ def test_goals(self):
statistical_measure="RMSE",
weightings=weightings)

# Check different KPIs for different goals:
goals = Goals(meas_target_data=meas_target_data,
variable_names=var_names,
statistical_measure=["RMSE", "MAE"])
# Check set_sim_target_data:
goals.set_sim_target_data(sim_target_data)

# Set relevant time interval test:
goals.set_relevant_time_intervals([(0, 100)])

# Check the eval_difference function:
self.assertIsInstance(goals.eval_difference(), float)

with self.assertRaises(ValueError):
# Test if wrong statistical_measure raises an error.
Goals(meas_target_data=meas_target_data,
variable_names=var_names,
statistical_measure="not a valid KPI")

with self.assertRaises(ValueError):
# Test that the length of the statistical_measure list is equal to the number of variables.
goals = Goals(meas_target_data=meas_target_data,
variable_names=var_names,
statistical_measure=["RMSE", "MAE", "MSE"])


def test_tuner_paras(self):
"""Test the class TunerParas"""
dim = np.random.randint(1, 100)
Expand Down

0 comments on commit df47550

Please sign in to comment.