Created
February 15, 2019 06:01
-
-
Save pytholabsbot1/4c5151fd9f785b4105188b16e025f8c9 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
##1. claculate entropy o the whole dataset | |
entropy_node = 0 #Initialize Entropy | |
values = df.play.unique() #Unique objects - 'Yes', 'No' | |
for value in values: | |
fraction = df.play.value_counts()[value]/len(df.play) | |
entropy_node += -fraction*np.log2(fraction) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment