src.model.deeplearn.initializer.kernel_point_ball_initializer
Classes
|
- class src.model.deeplearn.initializer.kernel_point_ball_initializer.KernelPointBallInitializer(target_radius=1.0, num_points=19, deformable=False, **kwargs)
- Author:
Alberto M. Esmoris Pena
A kernel point ball initializer initializes the structure space matrix representing the support points of a kernel. It will generate a structure space matrix \(\pmb{Q} \in \mathbb{R}^{m_q \times 3}\). This matrix represents \(m_q\) points in a 3D Euclidean space inside a ball of radius \(r\) such that the distances between points is maximized.
The points are distributed inside a ball solving an energy minimization problem for an energy model:
\[E = \sum_{i=1}^{m_q}{\biggl( \lVert\pmb{q}_{i*}\rVert^2 + \sum_{j=1,j\neq{i}}^{m_q}{ \lVert{ \pmb{q}_{i*} - \pmb{q}_{j*} }\rVert^{-1} } \biggr)}\]Note for a 3D space, the gradient of this energy model is defined as:
\[\begin{split}\nabla_{\pmb{Q}}E = \left[\begin{array}{ccc} \dfrac{\partial E}{\partial q_{1x}} & \dfrac{\partial E}{\partial q_{1y}} & \dfrac{\partial E}{\partial q_{1z}} \\ \vdots & \vdots & \vdots \\ \dfrac{\partial E}{\partial q_{m_q x}} & \dfrac{\partial E}{\partial q_{m_q y}} & \dfrac{\partial E}{\partial q_{m_q z}} & \end{array}\right]\end{split}\]For then, any partial derivative in the gradient can be computed as:
\[\dfrac{\partial E}{\partial q_{ik}} = 2 \left[ q_{ik} + \sum_{j=1,j\neq{i}}^{m_q}{\dfrac{ q_{jk} - q_{ik} }{ \lVert{\pmb{q}_{i*} - \pmb{q}_{j*}}\rVert^3 }} \right]\]Intuitively, this model can be thought as if every point caused a repulsive force on the others while the zero point imposes an attractive force on all the points. The minimization of the energy through a conjugate gradient method leads to the desired disposition of the points in \(\pmb{Q}\).
- Variables:
target_radius (float) – The radius of the ball to which the kernel points belong (\(r\)).
num_points (int) – The number of points representing the kernel \(m_q\).
deformable (bool) – Whether to allow the neural network to update the structure space of the kernel (i.e., the coordinates of the kernel points) or not.
- __init__(target_radius=1.0, num_points=19, deformable=False, **kwargs)
Initialize the member attributes of the initializer.
- Parameters:
target_radius (float) – The radius of the kernel’s ball.
num_points (int) – The number of kernel points.
deformable (bool) – True to make the kernel points trainable by the neural network, False otherwise.
- __call__(shape=None, dtype='float32')
Initialize a ball-like structure space matrix representing the support points of a kernel.
- Parameters:
shape – The shape parameter is ignored as the dimensionality of the initialized matrix depends on the arguments used to build the initializer.
- Returns:
The structure space matrix for a ball-like kernel point \(\pmb{Q} \in \mathbb{R}^{m_q \times 3}\).
- Return type:
tf.Tensor
- static energy_f(x)
Compute the energy model.
- Parameters:
x (
np.ndarray) – The vectorized matrix of input points.- Returns:
The energy.
- static energy_df(x)
Compute the gradient of the energy model.
- Parameters:
x (
np.ndarray) – The vectorized matrix of input points.- Returns:
The gradient of the energy.