SVEKER.kernels
.TanimotoKernel¶
- class SVEKER.kernels.TanimotoKernel(no_player_value=0.0)¶
Implements the Tanimoto Kernel
\(K(I, D) = \frac{I}{I+D}\)
- __init__(no_player_value=0.0) None ¶
Initializes the Tanimoto Kernel.
- delta_nu_fminus(n_i: int, n_d: int) float ¶
Calculates the change in the Tanimoto Kernel upon adding a feature to the symmetric difference.
\[\begin{split}\Delta\nu_{f^-} (N_i, N_d) = \begin{cases} -\nu(\varnothing) & \text{if } N_i = 0 \text{ and } N_d = 0 \\ 0 & \text{if } N_i = 0 \text{ and } N_d \neq 0 \\ \frac{N_i}{N_i + N_d + 1} - \frac{N_i}{N_i + N_d} & \text{else} \end{cases}\end{split}\]- Parameters:
n_i (int) – Number of elements in the intersection, \(N_i\)
n_d (int) – Number of elements in the symmetric difference, \(N_d\)
- Returns:
Change in kernel, \(\Delta\nu_{f^-}\)
- Return type:
float
- delta_nu_fplus(n_i: int, n_d: int) float ¶
Calculates the change in the Tanimoto Kernel upon adding a feature to the intersection.
\[\begin{split}\Delta\nu_{f^+} (N_i, N_d) = \begin{cases} 1 - \nu(\varnothing) & \text{if } N_i = 0 \text{ and } N_d = 0 \\ \frac{1}{N_d + 1} & \text{if } N_i = 0 \text{ and } N_d \neq 0 \\ \frac{N_i + 1}{N_i + N_d + 1} - \frac{N_i}{N_i + N_d} & \text{else} \end{cases}\end{split}\]- Parameters:
n_i (int) – Number of elements in the intersection, \(N_i\)
n_d (int) – Number of elements in the symmetric difference, \(N_d\)
- Returns:
Change in kernel, \(\Delta\nu_{f^+}\)
- Return type:
float
- get_kernel_function() Callable ¶
Returns the Kernel function to be used with sklearn.SVC or sklearn.SVR. See
kernel = 'precomputed'
in the sklearn documentaion for details.