Skip to content

Commit

Permalink
Fix: always output weighted average error
Browse files Browse the repository at this point in the history
  • Loading branch information
caic99 authored Nov 22, 2024
1 parent d1712c9 commit b77b895
Showing 1 changed file with 17 additions and 18 deletions.
35 changes: 17 additions & 18 deletions deepmd/entrypoints/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,24 +182,23 @@ def test(
if len(all_sys) != len(err_coll):
log.warning("Not all systems are tested! Check if the systems are valid")

if len(all_sys) > 1:
log.info("# ----------weighted average of errors----------- ")
log.info(f"# number of systems : {len(all_sys)}")
if isinstance(dp, DeepPot):
print_ener_sys_avg(avg_err)
elif isinstance(dp, DeepDOS):
print_dos_sys_avg(avg_err)
elif isinstance(dp, DeepProperty):
print_property_sys_avg(avg_err)
elif isinstance(dp, DeepDipole):
print_dipole_sys_avg(avg_err)
elif isinstance(dp, DeepPolar):
print_polar_sys_avg(avg_err)
elif isinstance(dp, DeepGlobalPolar):
print_polar_sys_avg(avg_err)
elif isinstance(dp, DeepGlobalPolar):
print_wfc_sys_avg(avg_err)
log.info("# ----------------------------------------------- ")
log.info("# ----------weighted average of errors----------- ")
log.info(f"# number of systems : {len(all_sys)}")
if isinstance(dp, DeepPot):
print_ener_sys_avg(avg_err)
elif isinstance(dp, DeepDOS):
print_dos_sys_avg(avg_err)

Check warning on line 190 in deepmd/entrypoints/test.py

View check run for this annotation

Codecov / codecov/patch

deepmd/entrypoints/test.py#L190

Added line #L190 was not covered by tests
elif isinstance(dp, DeepProperty):
print_property_sys_avg(avg_err)
elif isinstance(dp, DeepDipole):
print_dipole_sys_avg(avg_err)
elif isinstance(dp, DeepPolar):
print_polar_sys_avg(avg_err)
elif isinstance(dp, DeepGlobalPolar):
print_polar_sys_avg(avg_err)
elif isinstance(dp, DeepGlobalPolar):
print_wfc_sys_avg(avg_err)

Check warning on line 200 in deepmd/entrypoints/test.py

View check run for this annotation

Codecov / codecov/patch

deepmd/entrypoints/test.py#L197-L200

Added lines #L197 - L200 were not covered by tests
log.info("# ----------------------------------------------- ")


def mae(diff: np.ndarray) -> float:
Expand Down

0 comments on commit b77b895

Please sign in to comment.