Last active
August 8, 2018 06:36
-
-
Save lethalbrains/d11bcd5be8248c13580e0f5c97275253 to your computer and use it in GitHub Desktop.
This file contains 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
def __calculate_impurity_score(self, data): | |
if data is None or data.empty: return 0 | |
p_i, _ = data.value_counts().apply(lambda x: x/len(data)).tolist() | |
return p_i * (1 - p_i) * 2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment