edsnlp.pipes.trainable.layers.metric
Metric [source]
Bases: Module
Metric layer, used for computing similarities between two sets of vectors. A typical use case is to compute the similarity between a set of query vectors (input embeddings) and a set of concept vectors (output embeddings).
Parameters
| PARAMETER | DESCRIPTION |
|---|---|
in_features | Size of the input embeddings TYPE: |
out_features | Size of the output embeddings TYPE: |
num_groups | Number of groups for the output embeddings, that can be used to filter out certain concepts that are not relevant for a given query (e.g. do not compare a drug with concepts for diseases) TYPE: |
metric | Whether to compute the cosine similarity between the input and output embeddings or the dot product. TYPE: |
rescale | Rescale the output cosine similarities by a constant factor. TYPE: |