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:
- numpy (automatically installed when package is installed via pip)
Installation
The metrics package can be installed directly from pip
.
pip3 install metrics
Metrics
The metrics library currently has support for the following modules.
- Longest common subsequence metrics
distance_metrics.lcs
Longest common subsequence metrics
The LCS module currently implements 2 distances:
- Length of longest common subsequence (
distance_metrics.lcs.llcs(u, v)
). - 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
Release history Release notifications | RSS feed
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.1.tar.gz
(3.0 kB
view hashes)
Built Distribution
Close
Hashes for distance_metrics-0.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 646ff7f296915c0aa67c393161488f73126678ec77badeb1836a9f59f033ebbb |
|
MD5 | ab9ae99a7ae0f56a4c9bf63ff1dae1bc |
|
BLAKE2b-256 | 2b99bb2faf57cc632e7752a044d1434ea5b308ec378eea1ee127ba8294a93513 |