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. |
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)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| distance-metrics-0.0.2.tar.gz | 3.0 kB | Without provenance | Details for distance-metrics-0.0.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| distance_metrics-0.0.2-py3-none-any.whl | Python 3 | none | any | Details for distance_metrics-0.0.2-py3-none-any.whl |
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
|
Security for distance-metrics 0.0.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.