pairwise

package
Version: v0.0.0-...-aab6cd8 Latest Latest
Warning

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

Go to latest
Published: Feb 6, 2018 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package pairwise implements utilities to evaluate pairwise distances or inner product (via kernel).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Chebyshev

type Chebyshev struct{}

func NewChebyshev

func NewChebyshev() *Chebyshev

func (*Chebyshev) Distance

func (c *Chebyshev) Distance(vectorX *mat64.Dense, vectorY *mat64.Dense) float64

type Cosine

type Cosine struct{}

func NewCosine

func NewCosine() *Cosine

func (*Cosine) Distance

func (c *Cosine) Distance(vectorX *mat64.Dense, vectorY *mat64.Dense) float64

Distance computes Cosine distance. It will return distance which represented as 1-cos() (ranged from 0 to 2).

func (*Cosine) Dot

func (c *Cosine) Dot(vectorX *mat64.Dense, vectorY *mat64.Dense) float64

Dot computes dot value of vectorX and vectorY.

type Cranberra

type Cranberra struct{}

func NewCranberra

func NewCranberra() *Cranberra

func (*Cranberra) Distance

func (c *Cranberra) Distance(vectorX *mat64.Dense, vectorY *mat64.Dense) float64

type Euclidean

type Euclidean struct{}

func NewEuclidean

func NewEuclidean() *Euclidean

func (*Euclidean) Distance

func (e *Euclidean) Distance(vectorX *mat64.Dense, vectorY *mat64.Dense) float64

Distance computes Euclidean distance (also known as L2 distance).

func (*Euclidean) InnerProduct

func (e *Euclidean) InnerProduct(vectorX *mat64.Dense, vectorY *mat64.Dense) float64

InnerProduct computes a Eucledian inner product.

type Manhattan

type Manhattan struct{}

func NewManhattan

func NewManhattan() *Manhattan

func (*Manhattan) Distance

func (m *Manhattan) Distance(vectorX *mat64.Dense, vectorY *mat64.Dense) float64

Distance computes the Manhattan distance, also known as L1 distance. == the sum of the absolute values of elements.

type PairwiseDistanceFunc

type PairwiseDistanceFunc interface {
	Distance(vectorX *mat64.Dense, vectorY *mat64.Dense) float64
}

type PolyKernel

type PolyKernel struct {
	// contains filtered or unexported fields
}

func NewPolyKernel

func NewPolyKernel(degree int) *PolyKernel

NewPolyKernel returns a d-degree polynomial kernel

func (*PolyKernel) Distance

func (p *PolyKernel) Distance(vectorX *mat64.Dense, vectorY *mat64.Dense) float64

Distance computes distance under the polynomial kernel (maybe not needed?)

func (*PolyKernel) InnerProduct

func (p *PolyKernel) InnerProduct(vectorX *mat64.Dense, vectorY *mat64.Dense) float64

InnerProduct computes the inner product through a kernel trick K(x, y) = (x^T y + 1)^d

type RBFKernel

type RBFKernel struct {
	// contains filtered or unexported fields
}

func NewRBFKernel

func NewRBFKernel(gamma float64) *RBFKernel

NewRBFKernel returns a representation of a Radial Basis Function Kernel

func (*RBFKernel) InnerProduct

func (r *RBFKernel) InnerProduct(vectorX *mat64.Dense, vectorY *mat64.Dense) float64

InnerProduct computes the inner product through a kernel trick K(x, y) = exp(-gamma * ||x - y||^2)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to