src.model.deeplearn.initializer.fibonacci_shell_initializer
Classes
|
- class src.model.deeplearn.initializer.fibonacci_shell_initializer.FibonacciShellInitializer(shells=3, radii=[0, 0.5, 1.0], points_per_shell=[1, 7, 13], deformable=False, **kwargs)
- Author:
Alberto M. Esmoris Pena
A Fibonacci shell initializer initializes the structure space matrix representing the support points of a kernel, i.e., its structure space. 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 are maximized and the points are distributed along spherical shells inside the big sphere.
The initialization is governed by the number of shells \(S \in \mathbb{Z}_{>0}\), the radii for the shells \(\pmb{r} \in \mathbb{R}^{S}_{\geq 0}\), and the number of points per shell \(\pmb{n} \in \mathbb{Z}^{S}_{>0}\).
Now, let \(\pmb{q}_{k*}^{(s)} \in \mathbb{R}^{3}\) be the \(k\)-th point which is assumed to belong to the \(1 \leq s \leq S\) spherical shell. Its coordinates will be given by:
\[\begin{split}\pmb{q}_{k*}^{(s)} = \left[\begin{array}{c} \cos(\alpha_k) \sin(\beta_k) \\ \sin(\alpha_k) \sin(\beta_k) \\ \cos(\beta_k) \end{array}\right] \;,\quad \alpha_k = \dfrac{4 \pi k}{1 + \sqrt{5}} \;,\quad \beta_k = \arccos\left(1 - \dfrac{2k}{n_s}\right)\end{split}\]The above procedure exploits the concept of Fibonacci grid to provide an initial point distribution that is latter refined through energy minimization. More concretely, each point is considered to exert a repulsive force on each other leading to the energy function
\[E(\pmb{Q}) = \sum_{k=1}^{m_q}\sum_{l \neq k}{ \lVert\pmb{q}_{l*}-\pmb{q}_{k*}\rVert^{-1} } .\]The initialization ends with the conjugate gradient method used to solve the following minimization problem
\[\begin{split}\min_{\pmb{Q} \in \mathbb{R}^{m_q \times 3}} \quad & E(\pmb{Q}) \\ \text{s.t.} \quad \;\; & \left\lVert \pmb{q}_{k*}^{(s)} \right\rVert = r_s\end{split}\]- Variables:
shells (int) – The number of spherical shells.
radii (
np.ndarrayor list of int) – The radius for each shell.points_per_shell (
np.ndarrayor list of int) – The number of points for each shell.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__(shells=3, radii=[0, 0.5, 1.0], points_per_shell=[1, 7, 13], deformable=False, **kwargs)
Initialize the member attributes of the initializer.
- __call__(shape=None, dtype='float32')
The initializer’s computation logic.
- Parameters:
shape – The shape of the variable to initializer.
dtype – The type of value.
- Returns:
The initialized variable.
- static fibonacci_initialization(points, radius)
Compute the Fibonacci grid-based initialization.
- Parameters:
points – The number of points in the shell being initialized.
radius – The radius of the shell being initialized.
- Returns:
The structure space of the initialized shell.
- Return type:
np.ndarray
- energy_f(x)
Compute the energy model \(E\).
- Parameters:
x (
np.ndarray) – The vectorized structure space matrix.- Returns:
The energy model.
- static energy_df(x)
Compute the gradient of the energy model \(\nabla E\).
- Parameters:
x (
np.ndarray) – The vectorized structure space matrix.- Returns:
The gradient of the energy model.
- energy_constraint(x)
Force the constraint that each point belongs to its spherical shell.
- Parameters:
x (
np.ndarray) – The vectorized structure space matrix.- Returns:
The points of the energy model constrained to be at their corresponding spherical shells.
- Return type:
np.ndarray