ACEsuit / mace

MACE - Fast and accurate machine learning interatomic potentials with higher order equivariant message passing.
Other
413 stars 157 forks source link

fix rms/rmse for forces, off by a factor of 1/sqrt(3) #370

Closed misko closed 3 months ago

misko commented 3 months ago

In the current implementation RMS/RMSE of forces is scaled by a factor of 1/sqrt(3) to where I think it should be, although I might be wrong.

return np.sqrt(np.mean(np.square(delta))).item()

^ delta has shape (n,3) and n.mean() divides the sum out by n3, when it should only be dividing by n, averaging over number of atoms, not 3number of atoms.

I checked a https://github.com/mir-group/pytorch_runstats/blob/main/torch_runstats/_runstats.py#L206

For the RMS rescale factor it might not matter too much, but when reporting RMSE values for forces I think this results in RMSE being ~40% (1-1/sqrt(3)) off.

ilyes319 commented 3 months ago

Our implementation is actually the expected way we want to implement it. The mean squared error is defined by averaging across all dimensions, and the root mean squared error is just the root of that. The assumption is that every component of the predicted forces is a single, independent prediction of the model. As far I know, the vast majority of peoole follow that.

gabor1 commented 3 months ago

The distinction is force vector error or force component error. Both make sense. Most people report the latter (because it's smaller?)

misko commented 3 months ago

Thanks for the response! Makes sense!