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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file distance-metrics-0.0.2.tar.gz.
File metadata
- Download URL: distance-metrics-0.0.2.tar.gz
- Upload date:
- Size: 3.0 kB
- Tags: Source
- Uploaded using 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
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cc186adb8cd6bd630e05db46c755c9b9d8590f1c622975828195b1062c275d2c
|
|
| MD5 |
2e7d272059f2a1d7433dd0f49829a701
|
|
| BLAKE2b-256 |
e0e33268c0675dc755c8ef7616ce5e23813e3fdc7ccd7632a1570df38f9425c3
|
File details
Details for the file distance_metrics-0.0.2-py3-none-any.whl.
File metadata
- Download URL: distance_metrics-0.0.2-py3-none-any.whl
- Upload date:
- Size: 4.9 kB
- Tags: Python 3
- Uploaded using 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
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2c9527339e9d95af8795619b46f75a064ba97402c3d859d41b9460f78338f3bb
|
|
| MD5 |
f02cacff144892109b21653c5115ebfe
|
|
| BLAKE2b-256 |
12b8b5841f1dc13a4118298778548235e94a36dd7f1258e19a611bc5c30ea7fc
|