Skip to content

Instantly share code, notes, and snippets.

@Om4AI
Created February 22, 2022 18:52
Show Gist options
  • Save Om4AI/1479e6639c16efd7ce0fd082a21a57e4 to your computer and use it in GitHub Desktop.
Save Om4AI/1479e6639c16efd7ce0fd082a21a57e4 to your computer and use it in GitHub Desktop.
Next root in current dataframe
# 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