Skip to main content

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.

Metadata

Release files for distance-metrics 0.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for distance-metrics 0.0.2
File Size Uploaded
distance-metrics-0.0.2.tar.gz 3.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for distance-metrics 0.0.2
File Interpreter ABI Platform
distance_metrics-0.0.2-py3-none-any.whl Python 3 none any Details

Total release size: 7.9 kB

Release files / distance-metrics-0.0.2.tar.gz

Download URL distance-metrics-0.0.2.tar.gz
Size 3.0 kB
Tags Source
SHA-256 checksum
How to use checksums
cc186adb8cd6bd630e05db46c755c9b9d8590f1c622975828195b1062c275d2c
BLAKE2b-256 checksum
How to use checksums
e0e33268c0675dc755c8ef7616ce5e23813e3fdc7ccd7632a1570df38f9425c3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.0.0 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/3.6.5

Release files / distance_metrics-0.0.2-py3-none-any.whl

Download URL distance_metrics-0.0.2-py3-none-any.whl
Size 4.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2c9527339e9d95af8795619b46f75a064ba97402c3d859d41b9460f78338f3bb
BLAKE2b-256 checksum
How to use checksums
12b8b5841f1dc13a4118298778548235e94a36dd7f1258e19a611bc5c30ea7fc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.0.0 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/3.6.5

Release history Release notifications | RSS feed

This release

0.0.2 This release

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page