SNF
Similarity Network Fusion and spectral embedding.
Functions
motco.stats.snf.get_affinity_matrix(dats, K=20, eps=0.5)
Estimate the affinity matrix for all datasets in dats from the squared Euclidean distance.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dats
|
list[ndarray]
|
list of data sets to estimate the affinity matrix. |
required |
K
|
int
|
Number of K nearest neighbors to use. Default 20. |
20
|
eps
|
float
|
Normalization factor. Recommended between 0.3 and 0.8. Default 0.5. |
0.5
|
Returns:
| Name | Type | Description |
|---|---|---|
Ws |
list[ndarray]
|
list of affinity matrices |
Source code in src/motco/stats/snf.py
85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 | |
motco.stats.snf.SNF(Ws, k=20, t=20)
Similarity Network Fusion (SNF) across multiple affinity matrices.
The algorithm iteratively performs cross-diffusion using k-nearest neighbor sparse kernels and averages information from the other networks, producing a fused similarity matrix.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
Ws
|
list[ndarray]
|
List of affinity matrices to fuse. All matrices must have the same shape (n_samples x n_samples) and be symmetric. |
required |
k
|
int
|
Number of nearest neighbors for the sparse kernels. Default 20. |
20
|
t
|
int
|
Number of cross-diffusion iterations. Default 20. |
20
|
Returns:
| Name | Type | Description |
|---|---|---|
Pc |
ndarray
|
Fused similarity matrix (n_samples x n_samples). |
Source code in src/motco/stats/snf.py
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 | |
motco.stats.snf.get_spectral(aff, n_components=10)
Calculate spectral embedding from an affinity/similarity matrix.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
aff
|
ndarray
|
Affinity matrix to calculate the spectral embedding. |
required |
n_components
|
int
|
Number of spectral embedding components. Default 10. |
10
|
Returns:
| Name | Type | Description |
|---|---|---|
embedding |
ndarray
|
Spectral embedding. |
Source code in src/motco/stats/snf.py
133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 | |