Created
February 22, 2022 18:52
-
-
Save Om4AI/1479e6639c16efd7ce0fd082a21a57e4 to your computer and use it in GitHub Desktop.
Next root in current dataframe
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
# Function to get the next root node | |
def get_next_root(df, out_col, positive_attr): | |
l = list(df.columns) | |
l.remove(out_col) | |
# Get the root node | |
root = "" | |
max_infogain = 0 | |
for attr in l: | |
t = cal_information_gain(df, attr, out_col, positive_attr) | |
if(t>max_infogain): | |
max_infogain =t; | |
root = attr | |
return root |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment