MCPcopy Create free account
hub / github.com/SINGROUP/dscribe / AverageKernel

Class AverageKernel

dscribe/kernels/averagekernel.py:21–48  ·  view source on GitHub ↗

Used to compute a global similarity of structures based on the average similarity of local atomic environments in the structure. More precisely, returns the similarity kernel K as: .. math:: K(A, B) = \\frac{1}{N M}\sum_{ij} C_{ij}(A, B) where :math:`N` is the number of ato

Source from the content-addressed store, hash-verified

19
20
21class AverageKernel(LocalSimilarityKernel):
22 """Used to compute a global similarity of structures based on the average
23 similarity of local atomic environments in the structure. More precisely,
24 returns the similarity kernel K as:
25
26 .. math::
27 K(A, B) = \\frac{1}{N M}\sum_{ij} C_{ij}(A, B)
28
29 where :math:`N` is the number of atoms in structure :math:`A`, :math:`M` is
30 the number of atoms in structure :math:`B` and the similarity between local
31 atomic environments :math:`C_{ij}` has been calculated with the pairwise
32 metric (e.g. linear, gaussian) defined by the parameters given in the
33 constructor.
34 """
35
36 def get_global_similarity(self, localkernel):
37 """
38 Computes the average global similarity between two structures A and B.
39
40 Args:
41 localkernel(np.ndarray): NxM matrix of local similarities between
42 structures A and B, with N and M atoms respectively.
43 Returns:
44 float: Average similarity between the structures A and B.
45 """
46 K_ij = np.mean(localkernel)
47
48 return K_ij

Callers 6

test_differenceFunction · 0.90
test_metricsFunction · 0.90
test_xyFunction · 0.90
test_sparseFunction · 0.90
averagekernel.pyFile · 0.90

Calls

no outgoing calls

Tested by 5

test_differenceFunction · 0.72
test_metricsFunction · 0.72
test_xyFunction · 0.72
test_sparseFunction · 0.72