ccs_fit.fitting.objective
This module constructs and solves the spline objective.
Module Contents
Classes
Objective function for the ccs method. |
Attributes
- ccs_fit.fitting.objective.logger
- class ccs_fit.fitting.objective.Objective(l_twb, l_one, sto, energy_ref, force_ref, gen_params, energy_ewald=[], force_ewald=[])[source]
Objective function for the ccs method.
- predict(xx)[source]
Predict results.
- Parameters:
xx (ndarrray) – Solution array from training.
intervals (Needs to be updated to handle merging and dissolving) –
- static solver(pp, qq, gg, hh, aa, bb, maxiter=300, tol=(1e-10, 1e-10, 1e-10))[source]
The solver for the objective.
- Parameters:
pp (matrix) – P matrix as per standard Quadratic Programming(QP) notation.
qq (matrix) – q matrix as per standard QP notation.
gg (matrix) – G matrix as per standard QP notation.
hh (matrix) – h matrix as per standard QP notation
aa (matrix) – A matrix as per standard QP notation.
bb (matrix) – b matrix as per standard QP notation
maxiter (int, optional) – maximum iteration steps (default: 300).
tol (tuple, optional) – tolerance value of the solution (default: (1e-10, 1e-10, 1e-10)).
- Returns:
dictionary containing solution details
- Return type:
sol (dict)
- eval_obj(xx)[source]
Mean squared error function.
- Parameters:
xx (ndarray) – the solution for the objective
- Returns:
mean square error
- Return type:
float
- get_g(n_switch)[source]
Returns constraints matrix.
- Parameters:
n_switch (int) – switching point to change signs of curvatures.
- Returns:
returns G and A matrix
- Return type:
ndarray
- write_error(fname='CCS_error.out')[source]
Prints the errors in a file.
- Parameters:
mdl_eng (ndarray) – Energy prediction values from splines.
ref_eng (ndarray) – Reference energy values.
mse (float) – Mean square error.
fname (str, optional) – Output filename (default: ‘error.out’).
- write_error_forces(mdl_for, ref_for, fname='CCS_error_forces.out')[source]
Prints the errors in a file.
- Parameters:
mdl_eng (ndarray) – Energy prediction values from splines.
ref_eng (ndarray) – Reference energy values.
mse (float) – Mean square error.
fname (str, optional) – Output filename (default: ‘error.out’).