Skip to content

Commit

Permalink
Version submitted for review
Browse files Browse the repository at this point in the history
  • Loading branch information
Ejmric authored and tomazc committed May 12, 2023
0 parents commit 1519880
Show file tree
Hide file tree
Showing 50 changed files with 347,566 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
**/.DS_Store
.ipynb_checkpoints
.png
__pycache__
**/.nfs*
5 changes: 5 additions & 0 deletions Dockerfile-jupyter
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Start from a core stack version
FROM jupyter/scipy-notebook:python-3.10.6

COPY requirements.txt /tmp/
RUN conda install --file /tmp/requirements.txt
55 changes: 55 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
[![DOI](https://img.shields.io/badge/DOI-arXiv-red)](https://arxiv.org/abs/2305.06624)
[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/Ejmric/triFastSTMF/HEAD)

# triFastSTMF: Matrix tri-factorization over the tropical semiring

triFastSTMF is a tri-factorization approach for matrix approximation and prediction based on Fast Sparse Tropical Matrix Factorization (FastSTMF).

For details, please refer to Amra Omanović, Polona Oblak, and Tomaž Curk (2023). Matrix tri-factorization over the tropical
semiring. The preprint is available in [arXiv:2305.06624](https://arxiv.org/abs/2305.06624). If you use this work, please cite:
```
@misc{omanovic2023triFastSTMF,
title={Matrix tri-factorization over the tropical semiring},
author={Amra Omanović and Polona Oblak and Tomaž Curk},
year={2023},
eprint={2305.06624},
archivePrefix={arXiv},
primaryClass={cs.LG}
}
```

### Real data
We downloaded the real-world interaction dataset of an ant colony named "insecta-ant-colony3" [[1]](#1) from "Animal Social Networks" data collection on http://networkrepository.com [[2]](#2). Additional preprocessing before running our experiments is explained in the paper.

### Jupyter notebooks
The notebooks are independent and can be run in any order.

- [preprocessing_real_data.ipynb](https://github.com/Ejmric/triFastSTMF/blob/main/preprocessing_real_data.ipynb): Presents the preprocessing of the real-world interaction dataset of an ant colony.
- [heatmaps.ipynb](https://github.com/Ejmric/triFastSTMF/blob/main/heatmaps.ipynb): Presents the analysis of ants' behavioral patterns over 41 days.
- [real_exps.ipynb](https://github.com/Ejmric/triFastSTMF/blob/main/real_exps.ipynb): Presents the experiments on real data.
- [synthetic_network.ipynb](https://github.com/Ejmric/triFastSTMF/blob/main/synthetic_network.ipynb): Presents the analysis of four-partition network construction.


### Use
```
import numpy.ma as ma
import numpy as np
from triFastSTMF import triFastSTMF
data = ma.array(np.random.rand(100,100), mask=np.zeros((100,100)))
model = triFastSTMF(rank_1 = 5, rank_2 = 3, initialization="random_vcol", threshold=100)
model.fit(data)
approx = model.predict_all()
```

### References

<a id="1">[1]</a>
D. P. Mersch, A. Crespi, and L. Keller (2013). [Tracking individuals shows spatial
fidelity is a key regulator of ant social organization](https://www.science.org/doi/10.1126/science.1234316). Science, vol. 340, no.
6136, pp. 1090–1093.

<a id="2">[2]</a>
R. A. Rossi and N. K. Ahmed (2015) [The network data repository with
interactive graph analytics and visualization](http://networkrepository.com). AAAI. [Online].
Available: http://networkrepository.com
12,721 changes: 12,721 additions & 0 deletions data/adjacency_by_days.csv

Large diffs are not rendered by default.

25 changes: 25 additions & 0 deletions data/approx_errors_pseudo.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
8.886425028750360866e+01
8.056476518991343028e+01
8.667987165705456221e+01
9.063791279901336395e+01
8.846938459269098587e+01
8.477399856633218178e+01
5.864488295943305474e+01
5.784063584216792719e+01
9.063438066258521530e+01
7.527091361422725413e+01
9.253472336822852640e+01
9.463728720105470416e+01
8.333194545710165357e+01
9.837690220243010231e+01
7.400474455184459543e+01
9.884296117057488118e+01
8.291396623925186304e+01
8.042784439977856437e+01
7.798452957697963939e+01
7.934968391409306321e+01
8.410075823804683637e+01
1.007131261748051543e+02
8.518544151255655095e+01
8.947631948744191277e+01
9.010640292522195693e+01
25 changes: 25 additions & 0 deletions data/approx_errors_random.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
1.571757755175026432e+02
1.084801383992737414e+02
9.759804918085848158e+01
7.500456727017970593e+01
1.048478402712563167e+02
8.186838426889237041e+01
9.549045385641257155e+01
1.297530262379193857e+02
1.299447669194628361e+02
1.074498564150690214e+02
1.126064502034146244e+02
1.301354889740836995e+02
1.025994543764531102e+02
1.453258467277164243e+02
1.208473858339098683e+02
1.107657390718628534e+02
2.292047788709625706e+02
1.063278423089237492e+02
1.174040658589069892e+02
1.426166265972485121e+02
9.555865609709759667e+01
9.312668406186824654e+01
9.484670206259370673e+01
1.404329023688364657e+02
1.243191270191487234e+02
50 changes: 50 additions & 0 deletions data/centroids.csv

Large diffs are not rendered by default.

50 changes: 50 additions & 0 deletions data/centroids_logs.csv

Large diffs are not rendered by default.

Loading

0 comments on commit 1519880

Please sign in to comment.