Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How to find the permutation distribution for a list of matrices for calculating Shanon entropy of an Image

Where H(X)=−∑xp(x)logp(x) is the Shanon entropy.In accordance to the paper "History of art paintings through the lens of entropy and complexity"

>Solution :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

I recently worked on Exploratory work with painting datasets, Hope this satisfies your problem. According to the reference paper length of distribution cannot exceed 24.

def permutataion_distribution(matrix_list):
'''
Returns the distribution of matrix permutaions.
Input: 
    matrix_list: the output of sliding_matrix.
output: 
    num_of_perm: list of number of each permutations in order recieved
    list_of_perm: list of permutations in order recieved
    distribution: distrubution
    
'''
list_of_perm = []
num_of_perm = []
distribution = np.zeros(24)
for i in matrix_list:
    mat_perm = np.argsort((np.array[i]).flatten())
    indicator = 0
    for j in range(0, len(list_of_perm)):
        if np.all(mat_perm == list_of_perm[j]):
            num_of_perm[j] = num_of_perm[j] + 1
            indicator = 1
    if indicator == 0:
        list_of_perm.append(mat_perm)
        num_of_perm.append(1)
        
distribution = np.array(num_of_perm) / sum(num_of_perm)
return num_of_perm, list_of_perm, distribution
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading