Skip to content

Instantly share code, notes, and snippets.

View HundSimon's full-sized avatar
🍌
Not even close

Melaton HundSimon

🍌
Not even close
View GitHub Profile
import pandas as pd
import numpy as np
from scipy.stats import entropy
def calculate_entropy(data, n):
return 1/np.log(n)*entropy(data)
def calculate_weights(entropy_list):
weight_list = [1 - entropy_i for entropy_i in entropy_list]
return weight_list / sum(weight_list)