How to calculate information gain in ID3?
It's important to use the current partition.  See, e.g., the pseudocode in Wikipedia: https://en.wikipedia.org/wiki/ID3_algorithm#Pseudocode

Typically, this is implemented as a recursive algorithm.  When you recurse, you don't recurse on the entire training set; you  recurse on the subset of examples that reach the tree node you're trying to build.