Skip to content

Commit

Permalink
fix finetune RMSE result
Browse files Browse the repository at this point in the history
The previous RMSE result was actually MAE instead.

See also deepmodeling/deepmd-kit#2860.
  • Loading branch information
njzjz authored Sep 24, 2023
1 parent febbd53 commit 97bff01
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions deepmd_pt/model/task/fitting.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,9 +142,12 @@ def change_energy_bias(self, config, model, old_type_map, new_type_map, bias_shi
delta_bias = np.linalg.lstsq(type_numbs, bias_diff, rcond=None)[0]
unbias_e = energy_predict + type_numbs @ delta_bias
atom_numbs = type_numbs.sum(-1)
rmse_ae = (
np.sqrt(np.square(unbias_e - energy_ground_truth).reshape(-1)) / atom_numbs
).mean()
rmse_ae = np.sqrt(
np.mean(
np.square(unbias_e.ravel() - energy_ground_truth.ravel())
/ atom_numbs
)
)
self.bias_atom_e[idx_type_map] += torch.from_numpy(delta_bias.reshape(-1)).to(DEVICE)
logging.info(
"RMSE of atomic energy after linear regression is: {:10.5e} eV/atom.".format(
Expand Down

0 comments on commit 97bff01

Please sign in to comment.