Skip to content
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

Loftusa patch 3 #1054

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion graspologic/align/seedless_procrustes.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
from typing import Optional, Union

import numpy as np
import ot
from sklearn.utils import check_array

from graspologic.types import Tuple
Expand Down Expand Up @@ -285,8 +284,10 @@ def _optimal_transport(
cost_matrix = (
np.linalg.norm((X @ Q).reshape(n, 1, d) - Y.reshape(1, m, d), axis=2) ** 2
)
from ot import sinkhorn
# Note: the type info on ot.sinkhorn can support a return type of Tuple[np.ndarray, Dict[str, Any]], but only
# if this function is called with log=True, which we aren't doing.
import ot
P: np.ndarray = ot.sinkhorn(
a=probability_mass_X,
b=probability_mass_Y,
Expand Down
5 changes: 2 additions & 3 deletions graspologic/layouts/auto.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

import networkx as nx
import numpy as np
import umap
from sklearn.manifold import TSNE

from graspologic.types import Dict, List, Tuple
Expand Down Expand Up @@ -198,9 +197,9 @@ def layout_umap(
on Neighbor Embeddings along the Attraction-Repulsion Spectrum. ArXiv e-prints
2007.08902v1, 17 Jul 2020.
"""

from umap import UMAP
lcc_graph, tensors, labels = _node2vec_for_layout(graph, max_edges, random_seed)
points = umap.UMAP(
points = UMAP(
min_dist=min_dist, n_neighbors=n_neighbors, random_state=random_seed
).fit_transform(tensors)
positions = _node_positions_from(
Expand Down
2 changes: 1 addition & 1 deletion graspologic/match/solver.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

import numpy as np
from beartype import beartype
from ot import sinkhorn
from scipy.optimize import linear_sum_assignment
from sklearn.utils import check_scalar

Expand Down Expand Up @@ -363,6 +362,7 @@ def linear_sum_transport(
self,
P: np.ndarray,
) -> np.ndarray:
from ot import sinkhorn
maximize = self.maximize
reg = self.transport_regularizer

Expand Down