# FAQ: Decision Trees - Information Gain

This community-built FAQ covers the “Information Gain” exercise from the lesson “Decision Trees”.

Paths and Courses
This exercise can be found in the following Codecademy content:

## FAQs on the exercise Information Gain

There are currently no frequently asked questions associated with this exercise – that’s where you come in! You can contribute to this section by offering your own questions, answers, or clarifications on this exercise. Ask or answer a question by clicking reply () below.

If you’ve had an “aha” moment about the concepts, formatting, syntax, or anything else with this exercise, consider sharing those insights! Teaching others and answering their questions is one of the best ways to learn and stay sharp.

## Join the Discussion. Help a fellow learner on their journey.

You can also find further discussion and get answers to your questions over in #get-help.

Agree with a comment or answer? Like () to up-vote the contribution!

Need broader help or resources? Head to #get-help and #community:tips-and-resources. If you are wanting feedback or inspiration for a project, check out #project.

Looking for motivation to keep learning? Join our wider discussions in #community

Found a bug? Report it online, or post in #community:Codecademy-Bug-Reporting

Have a question about your account or billing? Reach out to our customer support team!

None of the above? Find out where to ask other questions here!

Dear Staff,

I appreciate the exercise but would like to ask two questions:

1. why the weighted gini is weighted as it is? The choice of weights is not intuitive for me.

2. Shouldn’t line 11 read as the following?
gini_info_gain_persons_2 = r_persons_2*gini_left_split + (1-r_persons_2)*gini_right_split
At the moment the line is not consistent with line 4, for instance.

Apart form that, it would be nice if you remove the “Revive the topic?” banner in this type of discussion. I understand the point of it in general discussions, but it discourages people to ask questions in FAQ-type topics, which are meant for that, aren’t they? I got the same banner for sharing a Portfolio Project and that really made me uneasy.

Thank you very much,

Llohann

2 Likes

Hello.
For the exercise 2 preloaded formula in scrypt.py seems to be not entirely correct even though it doesn’t affect result cause we multiply by “0”.
“r_persons_2 = 604/912 #read ratio of the split from the tree!
gini_left_split = 0.434
gini_right_split = 0
gini_info_gain_persons_2 = r_persons_2gini_left_split + r_persons_2gini_right_split”

but based on the lesson above as I understood it should look something like this:
r_left_persons_2 = 604/912
r_right_persons_2 = 308/912
gini_left_split = 0.434
gini_right_split = 0
gini_info_gain_persons_2 = r_left_persons_2gini_left_split + r_right_persons_2gini_right_split

please correct me if I’m wrong. Thank you.

2 Likes

I’m in agreement with the others that the second part of the exercise appears incorrect.

I’m also disappointed that nobody from Codecademy staff has ventured to step in.