rednafi / indoor-movement-prediction

Predicting user movements from temporal streams of RSS (Radio Signal Strength) measured between the nodes of a WSN (Wireless Sensor Network WSN)
MIT License
7 stars 3 forks source link

Error in running jupyter example #128

Open JafarAkhondali opened 4 years ago

JafarAkhondali commented 4 years ago

Hi, when I was running:

if __name__ == "__main__":
    decomp = DimensionDecomp(df)
    decomp.umap_project()

It gave error:

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-19-b1fd8c784da4> in <module>
      1 if __name__ == "__main__":
      2     decomp = DimensionDecomp(df)
----> 3     decomp.umap_project()

<ipython-input-15-b9b0a1fc250f> in umap_project(self)
     61 
     62         # get umap res
---> 63         umap_res = self._umap_comp()
     64 
     65         fig = px.scatter(

<ipython-input-15-b9b0a1fc250f> in _umap_comp(self)
     25     def _umap_comp(self):
     26         umap = UMAP(n_components=2, random_state=42)
---> 27         umap_res = umap.fit_transform(self.input_cols)
     28         umap_res = pd.DataFrame(umap_res, columns=["umap_x", "umap_y"])
     29         umap_res = pd.concat(

/usr/local/lib/python3.8/site-packages/umap/umap_.py in fit_transform(self, X, y)
   2010             Embedding of the training data in low-dimensional space.
   2011         """
-> 2012         self.fit(X, y)
   2013         return self.embedding_
   2014 

/usr/local/lib/python3.8/site-packages/umap/umap_.py in fit(self, X, y)
   1831                 self._search_graph.data = _data
   1832                 self._search_graph = self._search_graph.maximum(
-> 1833                     self._search_graph.transpose()
   1834                 ).tocsr()
   1835 

/usr/local/lib/python3.8/site-packages/scipy/sparse/lil.py in transpose(self, axes, copy)
    435 
    436     def transpose(self, axes=None, copy=False):
--> 437         return self.tocsr(copy=copy).transpose(axes=axes, copy=False).tolil(copy=False)
    438 
    439     transpose.__doc__ = spmatrix.transpose.__doc__

/usr/local/lib/python3.8/site-packages/scipy/sparse/lil.py in tocsr(self, copy)
    460             indptr = np.empty(M + 1, dtype=idx_dtype)
    461             indptr[0] = 0
--> 462             _csparsetools.lil_get_lengths(self.rows, indptr[1:])
    463             np.cumsum(indptr, out=indptr)
    464             nnz = indptr[-1]

_csparsetools.pyx in scipy.sparse._csparsetools.lil_get_lengths()

/usr/local/lib/python3.8/site-packages/scipy/sparse/_csparsetools.cpython-38-x86_64-linux-gnu.so in View.MemoryView.memoryview_cwrapper()

/usr/local/lib/python3.8/site-packages/scipy/sparse/_csparsetools.cpython-38-x86_64-linux-gnu.so in View.MemoryView.memoryview.__cinit__()

TypeError: a bytes-like object is required, not 'list'
rednafi commented 4 years ago

@JafarAkhondali Yes ...this is a known issue in the newer scipy versions. I've updated the dependencies. Should work as expected now. Let me know how it goes.