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.

Source Distribution

distance-metrics-0.0.2.tar.gz (3.0 kB view hashes)

Uploaded Source

Built Distribution

distance_metrics-0.0.2-py3-none-any.whl (4.9 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page