NormalizedDotProductMetric#

class kikuchipy.indexing.NormalizedDotProductMetric(n_experimental_patterns: Optional[int] = None, n_dictionary_patterns: Optional[int] = None, signal_mask: Optional[ndarray] = None, dtype: Union[str, dtype, type] = 'float32', rechunk: bool = False)[source]#

Bases: SimilarityMetric

Similarity metric implementing the normalized dot product [Chen et al., 2015].

The metric is defined as

\[\rho = \frac {\langle \mathbf{X}, \mathbf{Y} \rangle} {||\mathbf{X}|| \cdot ||\mathbf{Y}||},\]

where \({\langle \mathbf{X}, \mathbf{Y} \rangle}\) is the dot (inner) product of the pattern vectors \(\mathbf{X}\) and \(\mathbf{Y}\).

See SimilarityMetric for the description of the initialization parameters and the list of attributes.

Attributes

Methods

NormalizedDotProductMetric.match(...)

Match all experimental patterns to all dictionary patterns and return their similarities.

NormalizedDotProductMetric.prepare_dictionary(...)

Prepare dictionary patterns before matching to experimental patterns in match().

NormalizedDotProductMetric.prepare_experimental(...)

Prepare experimental patterns before matching to dictionary patterns in match().