nystrom-ncut 0.3.1__tar.gz → 0.3.3__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (25) hide show
  1. {nystrom_ncut-0.3.1/src/nystrom_ncut.egg-info → nystrom_ncut-0.3.3}/PKG-INFO +1 -1
  2. {nystrom_ncut-0.3.1 → nystrom_ncut-0.3.3}/pyproject.toml +1 -1
  3. {nystrom_ncut-0.3.1 → nystrom_ncut-0.3.3}/src/nystrom_ncut/nystrom/normalized_cut.py +4 -4
  4. {nystrom_ncut-0.3.1 → nystrom_ncut-0.3.3}/src/nystrom_ncut/nystrom/nystrom_utils.py +1 -1
  5. {nystrom_ncut-0.3.1 → nystrom_ncut-0.3.3/src/nystrom_ncut.egg-info}/PKG-INFO +1 -1
  6. {nystrom_ncut-0.3.1 → nystrom_ncut-0.3.3}/LICENSE +0 -0
  7. {nystrom_ncut-0.3.1 → nystrom_ncut-0.3.3}/MANIFEST.in +0 -0
  8. {nystrom_ncut-0.3.1 → nystrom_ncut-0.3.3}/README.md +0 -0
  9. {nystrom_ncut-0.3.1 → nystrom_ncut-0.3.3}/requirements.txt +0 -0
  10. {nystrom_ncut-0.3.1 → nystrom_ncut-0.3.3}/setup.cfg +0 -0
  11. {nystrom_ncut-0.3.1 → nystrom_ncut-0.3.3}/src/__init__.py +0 -0
  12. {nystrom_ncut-0.3.1 → nystrom_ncut-0.3.3}/src/nystrom_ncut/__init__.py +0 -0
  13. {nystrom_ncut-0.3.1 → nystrom_ncut-0.3.3}/src/nystrom_ncut/common.py +0 -0
  14. {nystrom_ncut-0.3.1 → nystrom_ncut-0.3.3}/src/nystrom_ncut/distance_utils.py +0 -0
  15. {nystrom_ncut-0.3.1 → nystrom_ncut-0.3.3}/src/nystrom_ncut/nystrom/__init__.py +0 -0
  16. {nystrom_ncut-0.3.1 → nystrom_ncut-0.3.3}/src/nystrom_ncut/nystrom/distance_realization.py +0 -0
  17. {nystrom_ncut-0.3.1 → nystrom_ncut-0.3.3}/src/nystrom_ncut/sampling_utils.py +0 -0
  18. {nystrom_ncut-0.3.1 → nystrom_ncut-0.3.3}/src/nystrom_ncut/transformer/__init__.py +0 -0
  19. {nystrom_ncut-0.3.1 → nystrom_ncut-0.3.3}/src/nystrom_ncut/transformer/axis_align.py +0 -0
  20. {nystrom_ncut-0.3.1 → nystrom_ncut-0.3.3}/src/nystrom_ncut/transformer/transformer_mixin.py +0 -0
  21. {nystrom_ncut-0.3.1 → nystrom_ncut-0.3.3}/src/nystrom_ncut/visualize_utils.py +0 -0
  22. {nystrom_ncut-0.3.1 → nystrom_ncut-0.3.3}/src/nystrom_ncut.egg-info/SOURCES.txt +0 -0
  23. {nystrom_ncut-0.3.1 → nystrom_ncut-0.3.3}/src/nystrom_ncut.egg-info/dependency_links.txt +0 -0
  24. {nystrom_ncut-0.3.1 → nystrom_ncut-0.3.3}/src/nystrom_ncut.egg-info/top_level.txt +0 -0
  25. {nystrom_ncut-0.3.1 → nystrom_ncut-0.3.3}/tests/test.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: nystrom_ncut
3
- Version: 0.3.1
3
+ Version: 0.3.3
4
4
  Summary: Normalized Cut and Nyström Approximation
5
5
  Author-email: Huzheng Yang <huze.yann@gmail.com>, Wentinn Liao <wentinn.liao@gmail.com>
6
6
  Project-URL: Documentation, https://github.com/JophiArcana/Nystrom-NCUT/
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "nystrom_ncut"
7
- version = "0.3.1"
7
+ version = "0.3.3"
8
8
  authors = [
9
9
  { name = "Huzheng Yang", email = "huze.yann@gmail.com" },
10
10
  { name = "Wentinn Liao", email = "wentinn.liao@gmail.com" },
@@ -54,10 +54,10 @@ class LaplacianKernel(OnlineKernel):
54
54
  self.A,
55
55
  num_eig=d + 1, # d * (d + 3) // 2 + 1,
56
56
  eig_solver=self.eig_solver,
57
- ) # [... x n x (d + 1)], [... x (d + 1)]
58
- self.Ainv = U @ torch.diag_embed(1 / L) @ U.mT # [... x n x n]
59
- self.a_r = torch.where(self.anchor_mask, torch.inf, torch.sum(self.A, dim=-1)) # [... x n]
60
- self.b_r = torch.zeros_like(self.a_r) # [... x n]
57
+ ) # [... x n x (d + 1)], [... x (d + 1)]
58
+ self.Ainv = U @ torch.nan_to_num(torch.diag_embed(1 / L), posinf=0.0, neginf=0.0) @ U.mT # [... x n x n]
59
+ self.a_r = torch.where(self.anchor_mask, torch.inf, torch.sum(self.A, dim=-1)) # [... x n]
60
+ self.b_r = torch.zeros_like(self.a_r) # [... x n]
61
61
 
62
62
  def _affinity(self, features: torch.Tensor) -> torch.Tensor:
63
63
  B = torch.where(self.anchor_mask[..., None], 0.0, affinity_from_features(
@@ -269,7 +269,7 @@ def solve_eig(
269
269
  bsz: int = A.shape[0]
270
270
 
271
271
  A = A + eig_value_buffer * torch.eye(A.shape[-1], device=A.device)
272
-
272
+ num_eig = min(A.shape[-1], num_eig)
273
273
  # compute eigenvectors
274
274
  if eig_solver == "svd_lowrank": # default
275
275
  # only top q eigenvectors, fastest
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: nystrom_ncut
3
- Version: 0.3.1
3
+ Version: 0.3.3
4
4
  Summary: Normalized Cut and Nyström Approximation
5
5
  Author-email: Huzheng Yang <huze.yann@gmail.com>, Wentinn Liao <wentinn.liao@gmail.com>
6
6
  Project-URL: Documentation, https://github.com/JophiArcana/Nystrom-NCUT/
File without changes
File without changes
File without changes
File without changes
File without changes