Args: alpha(float): Parameter controlling the entropic penalty. Values close to zero approach the best-match solution and values towards infinity approach the average kernel. threshold(float): Convergence threshold used in the
(
self,
alpha=0.1,
threshold=1e-6,
metric="linear",
gamma=None,
degree=3,
coef0=1,
kernel_params=None,
normalize_kernel=True,
)
| 42 | """ |
| 43 | |
| 44 | def __init__( |
| 45 | self, |
| 46 | alpha=0.1, |
| 47 | threshold=1e-6, |
| 48 | metric="linear", |
| 49 | gamma=None, |
| 50 | degree=3, |
| 51 | coef0=1, |
| 52 | kernel_params=None, |
| 53 | normalize_kernel=True, |
| 54 | ): |
| 55 | """ |
| 56 | Args: |
| 57 | alpha(float): Parameter controlling the entropic penalty. Values |
| 58 | close to zero approach the best-match solution and values |
| 59 | towards infinity approach the average kernel. |
| 60 | threshold(float): Convergence threshold used in the |
| 61 | Sinkhorn-algorithm. |
| 62 | metric(string or callable): The pairwise metric used for |
| 63 | calculating the local similarity. Accepts any of the sklearn |
| 64 | pairwise metric strings (e.g. "linear", "rbf", "laplacian", |
| 65 | "polynomial") or a custom callable. A callable should accept |
| 66 | two arguments and the keyword arguments passed to this object |
| 67 | as kernel_params, and should return a floating point number. |
| 68 | gamma(float): Gamma parameter for the RBF, laplacian, polynomial, |
| 69 | exponential chi2 and sigmoid kernels. Interpretation of the |
| 70 | default value is left to the kernel; see the documentation for |
| 71 | sklearn.metrics.pairwise. Ignored by other kernels. |
| 72 | degree(float): Degree of the polynomial kernel. Ignored by other |
| 73 | kernels. |
| 74 | coef0(float): Zero coefficient for polynomial and sigmoid kernels. |
| 75 | Ignored by other kernels. |
| 76 | kernel_params(mapping of string to any): Additional parameters |
| 77 | (keyword arguments) for kernel function passed as callable |
| 78 | object. |
| 79 | normalize_kernel(boolean): Whether to normalize the final global |
| 80 | similarity kernel. The normalization is achieved by dividing each |
| 81 | kernel element :math:`K_{ij}` with the factor |
| 82 | :math:`\sqrt{K_{ii}K_{jj}}` |
| 83 | """ |
| 84 | self.alpha = alpha |
| 85 | self.threshold = threshold |
| 86 | super().__init__(metric, gamma, degree, coef0, kernel_params, normalize_kernel) |
| 87 | |
| 88 | def get_global_similarity(self, localkernel): |
| 89 | """ |
nothing calls this directly
no outgoing calls
no test coverage detected