(x, centrality, sparse=True)
| 112 | |
| 113 | |
| 114 | def get_feature_weights(x, centrality, sparse=True): |
| 115 | if sparse: |
| 116 | x = x.to(torch.bool).to(torch.float32) |
| 117 | else: |
| 118 | x = x.abs() |
| 119 | w = x.t() @ centrality |
| 120 | w = w.log() |
| 121 | |
| 122 | return normalize(w) |
| 123 | |
| 124 | |
| 125 | def drop_feature_by_weight(x, weights, drop_prob: float, threshold: float = 0.7): |
nothing calls this directly
no test coverage detected