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.

Filename, size & hash SHA256 hash help File type Python version Upload date
distance_metrics-0.0.2-py3-none-any.whl (4.9 kB) Copy SHA256 hash SHA256 Wheel py3
distance-metrics-0.0.2.tar.gz (3.0 kB) Copy SHA256 hash SHA256 Source None

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page