deepmd.utils.out_stat#
Output statistics.
Functions#
| Compute the output statistics. |
| Compute the output statistics. |
Compute element-independent statistics for property fitting. |
Module Contents#
- deepmd.utils.out_stat.compute_stats_from_redu(output_redu: numpy.ndarray, natoms: numpy.ndarray, assigned_bias: numpy.ndarray | None = None, rcond: float | None = None) tuple[numpy.ndarray, numpy.ndarray][source]#
Compute the output statistics.
Given the reduced output value and the number of atoms for each atom, compute the least-squares solution as the atomic output bias and std.
- Parameters:
- output_redu
The reduced output value, shape is [nframes, *(odim0, odim1, …)].
- natoms
The number of atoms for each atom, shape is [nframes, ntypes].
- assigned_bias
The assigned output bias, shape is [ntypes, *(odim0, odim1, …)]. Set to a tensor of shape (odim0, odim1, …) filled with nan if the bias of the type is not assigned.
- rcond
Cut-off ratio for small singular values of a.
- Returns:
np.ndarrayThe computed output bias, shape is [ntypes, *(odim0, odim1, …)].
np.ndarrayThe computed output std, shape is [*(odim0, odim1, …)].
- deepmd.utils.out_stat.compute_stats_from_atomic(output: numpy.ndarray, atype: numpy.ndarray) tuple[numpy.ndarray, numpy.ndarray][source]#
Compute the output statistics.
Given the output value and the type of atoms, compute the atomic output bias and std.
- Parameters:
- output
The output value, shape is [nframes, nloc, ndim].
- atype
The type of atoms, shape is [nframes, nloc].
- Returns:
np.ndarrayThe computed output bias, shape is [ntypes, ndim].
np.ndarrayThe computed output std, shape is [ntypes, ndim].
- deepmd.utils.out_stat.compute_stats_do_not_distinguish_types(output_redu: numpy.ndarray, natoms: numpy.ndarray, assigned_bias: numpy.ndarray | None = None, intensive: bool = False) tuple[numpy.ndarray, numpy.ndarray][source]#
Compute element-independent statistics for property fitting.
Computes mean and standard deviation of the output, treating all elements equally. For extensive properties, the output is normalized by the total number of atoms before computing statistics.
- Parameters:
- output_redu
The reduced output value, shape is [nframes, *(odim0, odim1, …)].
- natoms
The number of atoms for each atom, shape is [nframes, ntypes]. Used for normalization of extensive properties and generating uniform bias.
- assigned_bias
The assigned output bias, shape is [ntypes, *(odim0, odim1, …)]. Set to a tensor of shape (odim0, odim1, …) filled with nan if the bias of the type is not assigned.
- intensive
Whether the output is intensive or extensive. If False, the output will be normalized by the total number of atoms before computing statistics.
- Returns:
np.ndarrayThe computed output mean(fake bias), shape is [ntypes, *(odim0, odim1, …)]. The same bias is used for all atom types.
np.ndarrayThe computed output standard deviation, shape is [ntypes, *(odim0, odim1, …)]. The same standard deviation is used for all atom types.