Essential Math, Editors Pick, Mathematics, Data Science, Machine Learning.
distribution is thus 0.5 and 1–0.5 = 0.5. Let’s use the function we just defined to calculate the corresponding entropy is: The function calculates the sum of P * np.log2(P) over each element of the array you use as input. Using an array as input As you saw in the previous section, you can expect a