Metric python3 module
Project description
METRIC-PY
A python wrapper for METRIC library (https://panda.technology/de/metric)
Installation
You need Python 3.6+
Linux & OS X
python -m pip install metric-py -i https://test.pypi.org/simple/
Windows (x64 only)
You will need to install any BLAS implementation. The easiest way is by using Miniconda:
conda config --add channels conda-forge
conda update -n base conda -y
conda install -c conda-forge libopenblas openblas -y
Then you can use pip to install
python -m pip install metric-py -i https://test.pypi.org/simple/
Build from the source
git clone --recurse-submodules https://github.com/panda-official/metric
Download and extract Boost (1.67+). For Windows there are pre-build binaries available.
Install Prerequisites
Ubuntu
sudo apt-get install cmake
sudo apt-get install libboost-all-dev
sudo apt-get install libopenblas-dev
Windows
Install Miniconda. In Conda CLI initialize your virtual environment with desired Python version:
conda create --name my_env -y python=3.8
conda activate my_env
Install OpenBLAS from alternative repo
conda config --add channels conda-forge
conda update -n base conda -y
conda install -c conda-forge libopenblas openblas -y
Build package
At least 2GB of RAM is required
python setup.py bdist_wheel
to limit memory usage during build add MAKE="make -j1"
:
MAKE="make -j1" python3 setup.py bdist_wheel
Install module
python -m pip install dist/*
Examples
import numpy
from metric.correlation import Entropy
from metric.distance import Euclidean, P_norm, Manhatten
aent = numpy.float_([
[5.0, 5.0],
[2.0, 2.0],
[3.0, 3.0],
[5.0, 1.0],
])
print("Entropies:")
for metric in (Euclidean, P_norm, Manhatten):
res = Entropy(metric=metric(), p=3, k=2)(aent)
print(f'using {metric}: {res:.5f}')
res = Entropy(p=3, k=2)(aent)
print(f'using Default: {res:.5f}')
for more examples please check examples/
folder
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 Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
Built Distributions
Close
Hashes for metric_py-0.0.6-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 29ad6a7617068ece99d786dcdc941bd2fb22ee04a4e2b9f28e1e7417b210ccf8 |
|
MD5 | 0817d289d100efe06d73077963c9db38 |
|
BLAKE2b-256 | 4f322adf80843a4fbb65ded2c33e0dd09da8b53a808dac96ce937ae5f3aeae2f |
Close
Hashes for metric_py-0.0.6-cp38-cp38-manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 23183069ebaf6d319ec3596f0dd29db4725b610538d8a4a9e40f637242a41971 |
|
MD5 | 539804b7380f7c24e6579d5976fc6f7b |
|
BLAKE2b-256 | 485aef2c545233218c5992aeb83b65c2d124aa4814721c53168f13b3062493e3 |
Close
Hashes for metric_py-0.0.6-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9f6e312a112ebf923cf7ccf5b507a90f755623c4f1550216ecfd13483f48101c |
|
MD5 | 4035b429f7dca06ad77e869deefa6f66 |
|
BLAKE2b-256 | b4fc772ec71252477bc4bfbcd45ec4bc39e9849dbb0d68f3aeb64ae0e786d7bd |
Close
Hashes for metric_py-0.0.6-cp37-cp37m-manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e1e9e3d30d2ab8900452e1deb72f0bbd0f4f41e7fc24f498eec7faa2d13bad6d |
|
MD5 | 12d8f5aabca5630b7aaa4bc0a67aaaa2 |
|
BLAKE2b-256 | a653c0425a0cfa759fcbd0ce8f1c32d389d01d87c1005306f88f377262ad5474 |
Close
Hashes for metric_py-0.0.6-cp36-cp36m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c89bf8a5f02bf866974507b381c5b75091d8a50d50c08646ba15931fddc93816 |
|
MD5 | 9c9589d17832996a6e229cd60017d481 |
|
BLAKE2b-256 | 375470b65ac4e122c4826011f87ee7e525780bfd589e1950b8c6a4c0d9e43073 |
Close
Hashes for metric_py-0.0.6-cp36-cp36m-manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5e6958f1e10790aef5b48eb0850758ae935cdfc2028235e84c21f03b08add986 |
|
MD5 | 3767cd6ff6c3ccaddecc49beb8aeea4a |
|
BLAKE2b-256 | e29f8bdbb0176c1c2f1cff8f86e9ab49c73968e1be609a4f15f3c456f1b3074a |