Kernel Base Class
The user-facing Regressors chapter documents the concrete
kernel classes (Kern_Linear, Kern_RBF, Kern_Polynomial,
Kern_Quadratic, Kern_LQ, Kern_Sigmoid).
The base class below is the API hook for adding new kernels.
-
class Kern_Base : public virtual tadah::models::Function_Base
Abstract class to be used as a base for all kernels.
b = basis vector
af = atomic energy descriptor
ff = force descriptor
all derivatives are defined wrt to the second argument
Subclassed by tadah::mlip::DM_Kern_Base, tadah::models::Kern_LQ, tadah::models::Kern_Linear, tadah::models::Kern_Polynomial, tadah::models::Kern_Quadratic, tadah::models::Kern_RBF, tadah::models::Kern_Sigmoid
Public Functions
-
virtual double prime(const tadah::core::aed_type &b, const tadah::core::aed_type &af, const tadah::core::aed_type &ff) const = 0
Calculate inner product of the kernel derivative wrt to the second argument (b wrt af) with the force descriptor
b = basis vector
af = atomic energy descriptor
ff = force descriptor (TODO i-th dir component of it) TODO consider calculating all 3-directions at once
-
inline virtual bool calc_dKdtheta(const std::string&, int, const tadah::core::aed_type&, const tadah::core::aed_type&, double&) const
Closed-form derivative of K(b, af) with respect to a named kernel hyperparameter.
Used by HPO analytical / hybrid gradients (Phase 2) — parallel to D2_Base::calc_dDdtheta on the kernel arm. The default returns false: “this kernel does not own theta_name”. Concrete kernels override for the (theta_name, arg_pos) pairs they implement.
Calling convention:
theta_name is the OPTIM key consumed by the kernel constructor; today the only registered key is “MPARAMS”.
arg_pos is the 1-based numerical-token position within the key’s value list (matching the OPTIM (n) parser convention in HPO; skips non-numerical tokens). See HPOTargets::ui_offset.
dK_out receives the scalar dK / d theta on return.
Return true iff this call wrote dK_out. The aggregator uses the bool to detect “no kernel owned this theta” and route via FD fallback (HYBRID) or raise (ANALYTICAL).
-
virtual void set_basis(const tadah::core::Matrix b)
Set basis for calculations.
-
virtual const tadah::core::Matrix &get_basis() const
Return basis stored by this object.
-
virtual tadah::core::Matrix get_basis()
Return basis stored by this object.