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 distance-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.2.tar.gz
(3.0 kB
view hashes)
Built Distribution
Close
Hashes for distance_metrics-0.0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2c9527339e9d95af8795619b46f75a064ba97402c3d859d41b9460f78338f3bb |
|
MD5 | f02cacff144892109b21653c5115ebfe |
|
BLAKE2b-256 | 12b8b5841f1dc13a4118298778548235e94a36dd7f1258e19a611bc5c30ea7fc |