Untitled

 avatar
unknown
plain_text
2 years ago
290 B
2
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...