kliff.analyzers#
- class kliff.analyzers.EnergyForcesRMSE(calculator, energy=True, forces=True)[source]#
Analyzer to compute the root-mean-square error (RMSE) for energy and forces.
The energy difference norm for a configuration is defined as:
where
is the prediction of the total energy from the model,
is the corresponding reference energy, and
is the number of atoms in the configuration. The division by
is applied only when
normalize = True
inrun
. Similarly, the forces difference norm for a configuration is defined as:where
is the prediction of the forces on atoms from the model and
is the corresponding reference forces,
is the number of atoms in the configuration. The division by
is applied only when
normalize = True
inrun
.The RMSEs for energy and forces are defined as:
and
in which
is the total number of configurations in the dataset.
- run(normalize=True, sort=None, path=None, verbose=1)[source]#
Run the RMSE analyzer.
- Parameters
normalize (bool) – Whether to normalize the energy (forces) by the number of atoms in a configuration.
sort (str (optional)) – Sort per configuration information according to energy or forces. If None, no sort. This works only when per configuration information is requested, i.e.
verbose > 0
.path (str (optional)) – Path to write out the results. If None, write to stdout, otherwise, write to the file specified by path. Note, if
verbose==3
, the difference of energy and forces will be written to a directory named energy_forces_RMSE-difference.verbose (int (optional)) – Verbose level of the output info. Available values are: 0, 1, 2. If
verbose=0
, only output the energy and forces RMSEs for the dataset. Ifverbose==1
, output the norms of the energy and forces for each configuration additionally. Ifverbose==2
, output the difference of the energy and forces for each atom, and the information is written to extended XYZ files with the location specified bypath
.
- class kliff.analyzers.Fisher(calculator)[source]#
Fisher information matrix.
Compute the Fisher information according to
- ..math::
I_{ij} = sum_m frac{partial bm f_m}{partial theta_i} cdot frac{partial bm f_m}{partial theta_j}
where
are the forces on atoms in configuration
,
is the ith model parameter. Derivatives are computed numerically using Ridders’ algorithm: https://en.wikipedia.org/wiki/Ridders%27_method
- Parameters
calculator – A calculator object.
- run(verbose=1)[source]#
Compute the Fisher information matrix and the standard deviation.
- Parameters
verbose (int) – If
0
, do not write out to file; if1
, write to a file namedanalysis_Fisher_info_matrix.txt
.- Returns
I (2D array, shape(N, N)) – Fisher information matrix, where N is the number of parameters.
I_stdev (2D array, shape(N, N)) – Standard deviation of Fisher information matrix, where N is the number of parameters.