[med-svn] [Git][med-team/umap-learn][upstream] New upstream version 0.5.1+dfsg

Andreas Tille (@tille) gitlab at salsa.debian.org
Fri Sep 10 07:09:14 BST 2021



Andreas Tille pushed to branch upstream at Debian Med / umap-learn


Commits:
3fa8c8d1 by Andreas Tille at 2021-09-10T08:05:04+02:00
New upstream version 0.5.1+dfsg
- - - - -


9 changed files:

- azure-pipelines.yml
- setup.py
- umap/__init__.py
- umap/layouts.py
- umap/plot.py
- umap/sparse.py
- umap/spectral.py
- umap/tests/test_umap_metrics.py
- umap/umap_.py


Changes:

=====================================
azure-pipelines.yml
=====================================
@@ -5,7 +5,6 @@
 
 trigger:
 - master
-- 0.5dev
 
 jobs:
   - job: Linux


=====================================
setup.py
=====================================
@@ -15,7 +15,7 @@ def readme():
 
 configuration = {
     "name": "umap-learn",
-    "version": "0.5.0",
+    "version": "0.5.1",
     "description": "Uniform Manifold Approximation and Projection",
     "long_description": readme(),
     "long_description_content_type": "text/x-rst",


=====================================
umap/__init__.py
=====================================
@@ -6,7 +6,27 @@ try:
         simplefilter("ignore")
         from .parametric_umap import ParametricUMAP
 except ImportError:
-    warn("Tensorflow not installed; ParametricUMAP will be unavailable")
+    warn(
+        "Tensorflow not installed; ParametricUMAP will be unavailable",
+         category=ImportWarning
+    )
+    # Add a dummy class to raise an error
+    class ParametricUMAP (object):
+
+        def __init__(self, **kwds):
+            warn(
+                """The umap.parametric_umap package requires Tensorflow > 2.0 to be installed.
+            You can install Tensorflow at https://www.tensorflow.org/install
+
+            or you can install the CPU version of Tensorflow using 
+
+            pip install umap-learn[parametric_umap]
+
+            """
+            )
+            raise ImportError(
+                "umap.parametric_umap requires Tensorflow >= 2.0") from None
+
 from .aligned_umap import AlignedUMAP
 
 # Workaround: https://github.com/numba/numba/issues/3341


=====================================
umap/layouts.py
=====================================
@@ -33,7 +33,7 @@ def clip(val):
     locals={
         "result": numba.types.float32,
         "diff": numba.types.float32,
-        "dim": numba.types.int32,
+        "dim": numba.types.intp,
     },
 )
 def rdist(x, y):


=====================================
umap/plot.py
=====================================
@@ -42,6 +42,7 @@ from matplotlib.patches import Patch
 from umap.utils import submatrix
 
 from bokeh.plotting import show as show_interactive
+from bokeh.plotting import output_file, output_notebook
 from bokeh.layouts import column
 from bokeh.models import CustomJS, TextInput
 from matplotlib.pyplot import show as show_static
@@ -1385,7 +1386,7 @@ def interactive(
             tooltip_dict = {}
             for col_name in hover_data:
                 data[col_name] = hover_data[col_name]
-                tooltip_dict[col_name] = "@" + col_name
+                tooltip_dict[col_name] = "@{" + col_name + "}"
             tooltips = list(tooltip_dict.items())
         else:
             tooltips = None


=====================================
umap/sparse.py
=====================================
@@ -288,15 +288,17 @@ def sparse_canberra(ind1, data1, ind2, data2):
 
 @numba.njit()
 def sparse_bray_curtis(ind1, data1, ind2, data2):  # pragma: no cover
-    abs_data1 = np.abs(data1)
-    abs_data2 = np.abs(data2)
-    denom_inds, denom_data = sparse_sum(ind1, abs_data1, ind2, abs_data2)
+    denom_inds, denom_data = sparse_sum(ind1, data1, ind2, data2)
+    denom_data = np.abs(denom_data)
 
     if denom_data.shape[0] == 0:
         return 0.0
 
     denominator = np.sum(denom_data)
 
+    if denominator == 0:
+        return 0.0
+
     numer_inds, numer_data = sparse_diff(ind1, data1, ind2, data2)
     numer_data = np.abs(numer_data)
 
@@ -589,7 +591,7 @@ sparse_named_distances = {
     # Other distances
     "canberra": sparse_canberra,
     "ll_dirichlet": sparse_ll_dirichlet,
-    # 'braycurtis': sparse_bray_curtis,
+    'braycurtis': sparse_bray_curtis,
     # Binary distances
     "hamming": sparse_hamming,
     "jaccard": sparse_jaccard,


=====================================
umap/spectral.py
=====================================
@@ -207,7 +207,7 @@ def multi_component_layout(
         distances = pairwise_distances([meta_embedding[label]], meta_embedding)
         data_range = distances[distances > 0.0].min() / 2.0
 
-        if component_graph.shape[0] < 2 * dim:
+        if component_graph.shape[0] < 2 * dim or component_graph.shape[0] <= dim + 1:
             result[component_labels == label] = (
                 random_state.uniform(
                     low=-data_range,


=====================================
umap/tests/test_umap_metrics.py
=====================================
@@ -270,6 +270,9 @@ def test_sparse_correlation(sparse_spatial_data):
     sparse_spatial_check("correlation", sparse_spatial_data)
 
 
+def test_sparse_braycurtis(sparse_spatial_data):
+    sparse_spatial_check("braycurtis", sparse_spatial_data)
+
 # ---------------------------
 # Sparse Binary Metric Tests
 # ---------------------------


=====================================
umap/umap_.py
=====================================
@@ -1283,7 +1283,6 @@ def init_graph_transform(graph, embedding):
     new_embedding: array of shape (n_new_samples, dim)
         An initial embedding of the new sample points.
     """
-    print("inside function\n", graph)
     result = np.zeros((graph.shape[0], embedding.shape[1]), dtype=np.float32)
 
     for row_index in range(graph.shape[0]):



View it on GitLab: https://salsa.debian.org/med-team/umap-learn/-/commit/3fa8c8d10c98a37d885fcd40590f1e53bf43734f

-- 
View it on GitLab: https://salsa.debian.org/med-team/umap-learn/-/commit/3fa8c8d10c98a37d885fcd40590f1e53bf43734f
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/debian-med-commit/attachments/20210910/84f910c4/attachment-0001.htm>


More information about the debian-med-commit mailing list