Created
August 6, 2020 13:45
-
-
Save evanthebouncy/8728aebe56b6a8bd4c1a73c04937ce51 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def normalise(mat, axis): | |
if axis == 0: | |
row_sums = mat.sum(axis=1) | |
new_matrix = mat / row_sums[:, np.newaxis] | |
return new_matrix | |
if axis == 1: | |
col_sums = mat.sum(axis=0) | |
new_matrix = mat / col_sums[np.newaxis, :] | |
return new_matrix | |
L0 = normalise(sat, 0) | |
start_acc = comm_acc(S0, L0) | |
S, L = S0, L0 | |
for i in range(100): | |
S = normalise(L, 1) | |
L = normalise(S, 0) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment