Standardize feature matrix and convert to tuple representation
(f, train_mask)
| 141 | return sparse_mx |
| 142 | |
| 143 | def standardize_data(f, train_mask): |
| 144 | """Standardize feature matrix and convert to tuple representation""" |
| 145 | # standardize data |
| 146 | f = f.todense() |
| 147 | mu = f[train_mask == True, :].mean(axis=0) |
| 148 | sigma = f[train_mask == True, :].std(axis=0) |
| 149 | f = f[:, np.squeeze(np.array(sigma > 0))] |
| 150 | mu = f[train_mask == True, :].mean(axis=0) |
| 151 | sigma = f[train_mask == True, :].std(axis=0) |
| 152 | f = (f - mu) / sigma |
| 153 | return f |
| 154 | |
| 155 | def preprocess_features(features): |
| 156 | """Row-normalize feature matrix and convert to tuple representation""" |
nothing calls this directly
no outgoing calls
no test coverage detected