spateo-release icon indicating copy to clipboard operation
spateo-release copied to clipboard

Optimized `SCC` Implementation and Removed `TensorFlow` Dependencies

Open Starlitnightly opened this issue 7 months ago • 8 comments

When installing spateo on macOS, I encountered version incompatibility errors. For instance, the vtk package requires a minimum Python version of 3.9. Additionally, installing both torch and tensorflow simultaneously can lead to package conflicts. After thoroughly reviewing the implementation of the relevant TensorFlow code, I rewrote all TensorFlow-related code using PyTorch and removed all TensorFlow-related dependencies from requirements.txt.

Updates:

  • Re-Implemented NLPCA using PyTorch instead of TensorFlow.
  • Re-Implemented weighted_binary_crossentropy using PyTorch instead of TensorFlow.
  • Re-implemented calculate_leiden_partitionand added logger.info.
  • Optimized label assignment by majority voting in the neighborhood using optimize_cluster.

Notes:

After carefully comparing the clustering effects of Leiden in scanpy and spateo, I found that the enhanced effect is due to dynamo.tl.neighbors compared to scanpy.pp.neighbors. The exact reason for this enhancement still needs further investigation.

Additionally, it is important to note that scc does not achieve state-of-the-art (SOTA) performance and does not yield better results on the gold standard dataset of human cortical neurons.

Since scc is an adjacency matrix that directly combines spatial neighborhoods and PCA neighborhoods, mclust is not applicable and was not included in this PR. Perhaps I could introduce STAGATE into the spateo framework and use it in place of PCA. However, this would introduce a new dependency, pyg, which might complicate updating the existing requirements.txt and incur additional installation costs for users.

image image image

Starlitnightly avatar Jul 22 '24 22:07 Starlitnightly