metric

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 24, 2024 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package metric holds different metrics for sets similarity compare

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Metric

type Metric interface {
	// MinY returns the minimum ngram cardinality for candidate
	MinY(alpha float64, size int) int
	// MinY returns the maximum ngram cardinality for candidate
	MaxY(alpha float64, size int) int
	// Threshold returns required intersection between A and B for given alpha
	Threshold(alpha float64, sizeA, sizeB int) int
	// Distance calculate distance between 2 sets
	Distance(inter, sizeA, sizeB int) float64
}

Metric defined here, is not pure mathematics metric definition as distance between each pair of elements of a set. Here we can also ask metric to give as minimum intersection between A and B for given alpha, min/max candidate cardinality

func CosineMetric

func CosineMetric() Metric

CosineMetric returns a Metric that represents Cosine Metric

func DiceMetric

func DiceMetric() Metric

DiceMetric returns a Metric that represents Dice Metric

func ExactMetric

func ExactMetric() Metric

ExactMetric returns a Metric that represents exact matching between 2 ngram sets

func JaccardMetric

func JaccardMetric() Metric

JaccardMetric returns a Metric that represents Jaccard Metric

func OverlapMetric

func OverlapMetric() Metric

OverlapMetric returns a Metric that represents Overlap metric

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL