a b/docs/source/index.rst
1
.. aggmap documentation master file, created by
2
   sphinx-quickstart on Tue Jul 26 16:11:13 2022.
3
   You can adapt this file completely to your liking, but it should at least
4
   contain the root `toctree` directive.
5
6
.. image:: ../images/logo_h.png
7
  :scale: 80 %
8
  :align: center
9
10
Jigsaw-like aggmap: A Robust and Explainable Multi-Channel Omics Deep Learning Tool
11
===========================================================================
12
13
aggmap package is developed to enhance the learning of the unordered and unstructured omics data. aggmap includes theree major modules, they are:
14
15
- **AggMap**: an unsupervised novel feature aggregation tool, which is developed to Aggregate and Map omics features into multi-channel 2D spatial-correlated image-like feature maps (Fmaps) based on their intrinsic correlations.AggMap is an unsupervised learning method because no label is required during feature restructuring. AggMap can be considered as a Fmap jigsaw puzzle solver because it solves jigsaw puzzles of unordered FPs based on their intrinsic similarities and topological structures.  It can also be regarded as a representation learning tool because it presents a 1D vector into an image-liked 3D tensor by self-supervised learning. It can employ manifold learning method such as `UMAP <https://joss.theoj.org/papers/10.21105/joss.00861>`_ to restructure unordered FPs by learning their intrinsic structures. The proxy task of umap-based **AggMap** is to minimize the differences between the two weighted topological graphs built in the input data space and embedding 2D space. Thus, AggMap can expose the overall topology of the FPs to generate structured Fmaps based on the intrinsic structure of FPs. 
16
- **AggMapNet**: a simple yet efficient CNN-based supervised learning model, which is developed for learning the output structured Fmaps of AggMap .
17
- **Explainers**: the model explaination modules (Shapley-explainer and Simply-explainer), which are developed to calculate the local and global feature importance, and based on the 2D-grid of AggMap, we can generate the explaination saliency-map based on the the feature importance score 
18
19
20
The details for the theory and usage can be found in our paper on `NAR <https://academic.oup.com/nar/article/50/8/e45/6517966>`_ and `SSRN <http://dx.doi.org/10.2139/ssrn.4129422>`_ :
21
22
- Shen W X, Liu Y, Chen Y, et al. AggMapNet: enhanced and explainable low-sample omics deep learning with feature-aggregated multi-channel networks[J]. Nucleic Acids Research, 2022, 50(8): e45-e45.
23
- Shen, W. X., Liang, S. R., Jiang Y., et al. Enhanced Metagenomic Deep Learning for Disease Prediction and Reproducible Signature Identification by Restructured Microbiome 2D-Representations. SSRN: http://dx.doi.org/10.2139/ssrn.4129422, under review.
24
25
26
You can find the software `on github <https://github.com/shenwanxiang/bidd-aggmap/>`_.
27
28
Look how easy it is to use:
29
30
.. code:: python3
31
32
    import pandas as pd
33
    from sklearn.datasets import load_breast_cancer
34
    from aggmap import AggMap, AggMapNet
35
36
    # Data loading
37
    data = load_breast_cancer()
38
    dfx = pd.DataFrame(data.data, columns=data.feature_names)
39
    dfy = pd.get_dummies(pd.Series(data.target))
40
41
    # AggMap object definition, fitting, and saving 
42
    mp = AggMap(dfx, metric = 'correlation')
43
    mp.fit(cluster_channels=5, emb_method = 'umap', verbose=0)
44
    mp.save('agg.mp')
45
46
    # AggMap visulizations: Hierarchical tree, embeddng scatter and grid
47
    mp.plot_tree()
48
    mp.plot_scatter(enabled_data_labels=True, radius=5)
49
    mp.plot_grid(enabled_data_labels=True)
50
51
    # Transoformation of 1d vectors to 3D Fmaps (-1, w, h, c) by AggMap
52
    X = mp.batch_transform(dfx.values, n_jobs=4, scale_method = 'minmax')
53
    y = dfy.values
54
55
    # AggMapNet training, validation, early stopping, and saving
56
    clf = AggMapNet.MultiClassEstimator(epochs=50, gpuid=0)
57
    clf.fit(X, y, X_valid=None, y_valid=None)
58
    clf.save_model('agg.model')
59
60
    # Model explaination by simply-explainer: global, local
61
    simp_explainer = AggMapNet.simply_explainer(clf, mp)
62
    global_simp_importance = simp_explainer.global_explain(clf.X_, clf.y_)
63
    local_simp_importance = simp_explainer.local_explain(clf.X_[[0]], clf.y_[[0]])
64
65
    # Model explaination by shapley-explainer: global, local
66
    shap_explainer = AggMapNet.shapley_explainer(clf, mp)
67
    global_shap_importance = shap_explainer.global_explain(clf.X_)
68
    local_shap_importance = shap_explainer.local_explain(clf.X_[[0]])
69
70
71
72
.. toctree::
73
   :maxdepth: 3
74
   :caption: Content
75
76
   install
77
   api
78
   hps
79
   examples
80
   performances
81
   modules
82
83
   
84
85
**Contribute**
86
----------
87
88
- Issue Tracker: https//github.com/shenwanxiang/bidd-aggmap/issues
89
- Source Code: https//github.com/shenwanxiang/bidd-aggmap/
90
91
**Support**
92
-------
93
94
If you are having issues, please let us know.
95
We have a mailing list located at: wanxiang.shen@u.nus.edu
96
97
**License**
98
-------
99
100
The project is licensed under the  GPL-3.0 license.
101
102
103
104
**Indices and tables**
105
==================
106
107
* :ref:`genindex`
108
* :ref:`modindex`
109
* :ref:`search`