A sparsity aware implementation of "Deep Autoencoder-like Nonnegative Matrix Factorization for Community Detection" (CIKM 2018).
Alternatives To Danmf
Project NameStarsDownloadsRepos Using ThisPackages Using ThisMost Recent CommitTotal ReleasesLatest ReleaseOpen IssuesLicenseLanguage
Lightfm4,33828177 days ago14November 27, 2020142apache-2.0Python
A Python implementation of LightFM, a hybrid recommendation algorithm.
Implicit3,16322102 days ago43January 29, 202283mitPython
Fast Python Collaborative Filtering for Implicit Feedback Datasets
5 months ago72mitPython
Deep recommender models using PyTorch.
Awesome Community Detection2,111
2 months ago1cc0-1.0Python
A curated list of community detection research papers with implementations.
8a year ago8November 23, 201752otherPython
fastFM: A Library for Factorization Machines
7 months ago1gpl-3.0Python
A parallel implementation of "graph2vec: Learning Distributed Representations of Graphs" (MLGWorkshop 2017).
3 months ago21November 29, 20202apache-2.0Python
TOROS Buffalo: A fast and scalable production-ready open source project for recommender systems
2 months ago15August 14, 2022mitPython
This is the repository of our article published in RecSys 2020 "Are We Evaluating Rigorously? Benchmarking Recommendation for Reproducible Evaluation and Fair Comparison" and of several follow-up studies.
Armadillo Code403
a year ago1
Armadillo: fast C++ library for linear algebra & scientific computing - http://arma.sourceforge.net
7 months agogpl-3.0Python
A PyTorch Implementation of "Watch Your Step: Learning Node Embeddings via Graph Attention" (NeurIPS 2018).
Alternatives To Danmf
Select To Compare

Alternative Project Comparisons


codebeat badge repo sizebenedekrozemberczki

An implementation of Deep Autoencoder-like Nonnegative Matrix Factorization for Community Detection (CIKM 2018).


Community structure is ubiquitous in real-world complex networks. The task of community detection over these networks is of paramount importance in a variety of applications. Recently, nonnegative matrix factorization (NMF) has been widely adopted for community detection due to its great interpretability and its natural fitness for capturing the community membership of nodes. However, the existing NMF-based community detection approaches are shallow methods. They learn the community assignment by mapping the original network to the community membership space directly. Considering the complicated and diversified topology structures of real-world networks, it is highly possible that the mapping between the original network and the community membership space contains rather complex hierarchical information, which cannot be interpreted by classic shallow NMF-based approaches. Inspired by the unique feature representation learning capability of deep autoencoder, we propose a novel model, named Deep Autoencoder-like NMF (DANMF), for community detection. Similar to deep autoencoder, DANMF consists of an encoder component and a decoder component. This architecture empowers DANMF to learn the hierarchical mappings between the original network and the final community assignment with implicit low-to-high level hidden attributes of the original network learnt in the intermediate layers. Thus, DANMF should be better suited to the community detection task. Extensive experiments on benchmark datasets demonstrate that DANMF can achieve better performance than the state-of-the-art NMF-based community detection approaches.

The model is now also available in the package Karate Club.

This repository provides an implementation for 0DANMF as described in the paper:

Deep Autoencoder-like Nonnegative Matrix Factorization for Community Detection. Fanghua Ye, Chuan Chen, and Zibin Zheng. CIKM, 2018. [Paper]

A MatLab reference implementation is available [here].


The codebase is implemented in Python 3.5.2. package versions used for development are just below.

networkx          1.11
tqdm              4.28.1
numpy             1.15.4
pandas            0.23.4
texttable         1.5.0
scipy             1.1.0
argparse          1.1.0
sklearn           0.20.0


The code takes an input graph in a csv file. Every row indicates an edge between two nodes separated by a comma. The first row is a header. Nodes should be indexed starting with 0. Sample graphs for the `Twitch Brasilians` ,`Wikipedia Chameleons` and `Wikipedia Giraffes` are included in the `input/` directory.


Learning of the embedding is handled by the `src/main.py` script which provides the following command line arguments.

Input and output options

  --edge-path         STR    Input graph path.       Default is `input/ptbr_edges.csv`.
  --membership-path   STR    Membership path.        Default is `output/ptbr_membership.json`.
  --output-path       STR    Embedding path.         Default is `output/ptbr_danmf.csv`.

Model options

  --iterations            INT         Number of epochs.                     Default is 100.
  --pre-iterations        INT         Layer-wise epochs.                    Default is 100.
  --seed                  INT         Random seed value.                    Default is 42.
  --lamb                  FLOAT       Regularization parameter.             Default is 0.01.
  --layers                LST         Layer sizes in autoencoder model.     Default is [32, 8]
  --calculate-loss        BOOL        Loss calculation for the model.       Default is False. 


The following commands learn a graph embedding and write this embedding to disk. The node representations are ordered by node identifiers. Layer sizes are always set manually.

Creating a DANMF embedding of the default dataset with a 128-64-32-16 architecture. Saving the embedding at the default path.

python src/main.py --layers 128 64 32 16

Creating a DANMF embedding of the default dataset with a 96-8 architecture and calculationg the loss.

python src/main.py --layers 96 8 --calculate-loss

Creating a single layer DANMF embedding with 32 factors.

python src/main.py --layers 32

Creating an embedding with some custom cluster number in the bottleneck layer.

python src/main.py --layers 128 64 7

Creating an embedding of another dataset the Wikipedia Chameleons. Saving the output in a custom folder.

python src/main.py --layers 32 8 --edge-path input/chameleon_edges.csv --output-path output/chameleon_danmf.csv --membership-path output/chameleon_membership.json


Popular Matrix Factorization Projects
Popular Machine Learning Projects
Popular Machine Learning Categories
Related Searches

Get A Weekly Email With Trending Projects For These Categories
No Spam. Unsubscribe easily at any time.
Machine Learning
Deep Learning
Data Science
Unsupervised Learning
Matrix Factorization