Skip to main content

Python module of less-common metrics.

Project description

Metrics

Python implementation of some more uncommon metrics. Currently only longest common subsequence LCS metrics are implemented.

Dependencies

This package requires the following python libraries:

  1. numpy (automatically installed when package is installed via pip)

Installation

The metrics package can be installed directly from pip.

pip3 install distance-metrics

Metrics

The metrics library currently has support for the following modules.

  1. Longest common subsequence metrics distance_metrics.lcs

Longest common subsequence metrics

The LCS module currently implements 2 distances:

  1. Length of longest common subsequence (distance_metrics.lcs.llcs(u, v)).
  2. Bakkelund distance [1] (metrics.lcs.bakkelund(u, v))

Usage

# Imports
from distance_metrics import lcs
import numpy as np

# Create example input arrays
u = np.random.choice(list('ABCD'), size=20)
v = np.random.choice(list('BCDE'), size=20)

# Compute metrics
llcs      = lcs.llcs(u, v)
bakkelund = lcs.bakkelund(u, v)

# Print values
print("LLCS     : {}".format(llcs))
print("Bakkelund: {}".format(bakkelund))
References
1 Bakkelund, D. (2009). An LCS-based string metric. Olso, Norway: University of Oslo.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for distance-metrics, version 0.0.2
Filename, size File type Python version Upload date Hashes
Filename, size distance_metrics-0.0.2-py3-none-any.whl (4.9 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size distance-metrics-0.0.2.tar.gz (3.0 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page