Untitled
Anonymous
plain_text
10/10/2022 4:31 PM
388 B
15
Indexable
entropy=0 #Store initial value of the entropy node obj=df.Play.unique() #To ensure only unique values for 'Play' attribute for i in obj: f=df.Play.value_counts()[i]/len(df.Play) #calculate the fraction to use for entropy formula entropy = -f*np.log2(f) + entropy #entropy formula
Editor is loading...