Comments (5)
It shouldn't really matter whether the bins of your histograms are indexed by three or any other number of coordinates, as long as you construct the distance matrix appropriately.
Just np.ravel
the signatures so that they're 1-dimensional, and build the distance matrix so that the i,j
th entry is the ground distance between point i = (x_1, y_1, z_1)
and point j = (x_2, y_2, z_2)
. You'll need a mapping between integer indices and 3D points.
from pyemd.
Hi again,
thanks for the fast reply. After looking more closely to the example, I'm unsure as to how I can translate my problem to the histogram setting. Basically I have 2 sets of size N, with a NxN matrix of pairwise distances. In the example, the distance matrix seems to show cost to move from 1 histogram to another, whereas mine are actual distances. Given this information, do you think I can leverage your code ?
Thank you
from pyemd.
If you take a look at the API section of the README, the distance matrix is exactly that: an N
by N
matrix that gives the pairwise distance between the histogram bins (the “ground distance”). The EMD between the histograms is the output of the emd
function, not one of its arguments.
from pyemd.
The only way I can think of adapting this to the histogram setting is by by setting first_historgram to be a vector of size 2Nx1, where the first N are 0's and the last N are 1's (and vice versa for second_histogram).
Then I would need to convert my NxN matrix into a 2Nx2N matrix where the top left and bottom right quadrant are filled with zeros. Note that the 2 sets contain different elements, and I don't have distances between points in the same set.
Unfortunately, that's too much overhead since I have N =~ 2500. You seem to say there is an easy to plugging this in your API. I'd like to apologise, as I cannot cleary see it.
Thanks for the help
from pyemd.
If you don't want to allow moving mass within a histogram, then yes, you need to pad them with zeros as you described—however, the top-left and bottom-right blocks of the distance matrix should be filled with a value that's higher than any other, not with zero, as that would mean moving mass within a histogram is free (and allowed).
If your histogram just consists of 1
s, then your problem is an instance of minimum-cost bipartite matching: you need to find the minimum-cost way of pairing up points in either set. The EMD is more general; you might find better performance with another optimization library that solves that problem specifically. Furthermore, since you're dealing with a 3-dimensional space equipped with some metric, then there are additional constraints on costs between the points; you might be able to exploit that structure to get a faster solution than in the general cost case if you write your own solver.
In any case, none of this requires additional implementation to support multi-dimensional points, so I'm closing this issue.
from pyemd.
Related Issues (20)
- pyemd in databricks could not be installed HOT 2
- pyemd not building on MacOS X "Mojave" + Python 3.7 HOT 3
- Cannot install using pip with python3.6 and RHEL 7 HOT 1
- Can't install pyemd v0.4.4 HOT 1
- pyemd not building on MacOS X "Catalina" + Python 3.7 HOT 14
- Missing control of the input vectors HOT 3
- ERROR: Failed building wheel for pyemd HOT 1
- do you have more challenging example than on main page HOT 5
- PyEMD installation version 0.5.1 fails on Linux HOT 2
- building 'pyemd.emd' extension error: Microsoft Visual C++ 14.0 is required. HOT 2
- some tests hang using 100% CPU forever on 32-bit Debian powerpc
- Error while installing pyemd on Ubuntu 20.04 HOT 2
- Addition of New feature: Statistical Significance test of Residue or trend component HOT 3
- EMD not leading to any results, without any error raised HOT 1
- Zero EMD for equal Histograms HOT 1
- python 3.11 support HOT 2
- ERROR: Failed building wheel for pyemd
- switch from setup.py to pyproject.toml HOT 3
- new release? HOT 1
- Version 1.0.0 was not tagged on GitHub HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pyemd.