Created
October 3, 2016 16:59
-
-
Save auxiliary/4d8722ced851d70f507bca87db0499ec to your computer and use it in GitHub Desktop.
This file contains 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
#!/usr/bin/env python | |
import numpy as np | |
def getDegree(ref_id, grid_list): | |
results = np.zeros(grid_list[0].shape) | |
for i, grid in enumerate(grid_list): | |
results += (grid_list[ref_id] == grid) | |
return results / float(len(grid_list)) * 100 | |
def test(): | |
grids = [] | |
for i in range(3): | |
grids.append(np.random.randint(0, 10, (3, 3, 3))) | |
for g in grids: | |
print g.flatten() | |
print getDegree(0, grids).flatten().astype("int") | |
if __name__ == '__main__': | |
test() | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment