-
Notifications
You must be signed in to change notification settings - Fork 483
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[WIP] quantized gromov wasserstein solver #603
base: master
Are you sure you want to change the base?
Conversation
…fficient for numpy and torch
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## master #603 +/- ##
==========================================
+ Coverage 96.78% 96.79% +0.01%
==========================================
Files 77 78 +1
Lines 16027 16270 +243
==========================================
+ Hits 15511 15748 +237
- Misses 516 522 +6 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is nice, I have a few comments below, contact me on slack if you want to discuss them
# Compute their quantized Gromov-Wasserstein distance using the wrapper | ||
# --------------------------------------------------------- | ||
|
||
# 0) qGW(spC2, h2, spC3, h3) while partitioning the adjacency matrices C2 and C3 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I dont undestand this sentence, maybe do bity. with and without the C? Also I dont' understand what those two ways to represnet the graph are used for
spC2, spC3, 2, 3, C2, C3, h2, h3, part_method=part_method, | ||
rep_method=rep_method, log=True) | ||
|
||
qGW_dist = log['qGW_dist'] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
visualize stuff here
# 1-a) Partition C2 and C3 in 2 and 3 clusters respectively using the Fluid | ||
# algorithm implementation from networkx. Encode these partitions via vectors of assignments. | ||
|
||
part2 = _get_partition(C2, npart=2, part_method=part_method) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I woudl put the two steps partion then qg efore the usinuqe function so that the user undrstand better
ot/gromov/_quantized.py
Outdated
|
||
""" | ||
if (part_method in ['fluid', 'louvain'] or rep_method == 'pagerank') and (not networkx_import): | ||
warnings.warn( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
missing line in tests
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this one cna be tested with the test-minila that do not install networkx
rep_method = 'random' | ||
|
||
if (part_method in ['kmeans', 'spectral'] or rep_method == 'kmeans') and (not sklearn_import): | ||
warnings.warn( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
here too
Types of changes
Implementation of first solvers for the quantized Fused Gromov-Wasserstein (qFGW) distance.
ot/gromov/_quantized.py
andtest/gromov/test_quantized.py
.quantized_fused_gromov_wasserstein_partitioned
: main function to compute the OT between two partitioned joint spaces with minimal inputs to compute global and local alignments, so that the user can perform any partitioning and representant selection as pre-processing. A boolean optionbuild_OT
allows the user to construct the OT matrix between non-partitioned spaces which might require a lot of memory. Other inputs mainly relate to innerfused_gromov_wasserstein
,gromov_wasserstein
andemd_1d
solvers.remark 1 : i) only the (F)GW conditional gradient solver is considered here. Note that authors also made use of the entropic projected gradient solver. ii) only the square loss is considered for both types of OT problems.
quantized_fused_gromov_wasserstein
: main function to compute the OT between two joint spaces with axioms used by authors to partition both spaces. Taking as inputs structure matricesC1
andC2
treated as graphs, optionally as feature matricesF1
andF2
, optionally other structure matricesC1_aux
andC2_aux
used for partitioning and representant selection implemented inget_graph_partition
andget_graph_representants
.quantized_fused_gromov_wasserstein_samples
: main function to compute the OT between two distributions in different spaces potentially endowed with features, with axioms used by authors to partition both spaces. Taking as inputs samplesX1
andX2
endowed with an euclidean geometry on their respective space, optionally with feature matricesF1
andF2
, where both can be considered for partitioning and representant selection (e.g kmeans) implemented inget_partition_and_representants_samples
.Motivation and context / Related issue
How has this been tested (if it applies)
test.test_gromov.py::test_quantized_gromov
PR checklist