Open
Description
Some places need to use iloc
to slice instead of default accessors.
def _best_split(self, X, y, feat_idxs):
best_gain = -1
split_idx, split_threshold = None, None
for feat_idx in feat_idxs:
# iloc instead
X_column = X.iloc[:, feat_idx]
thresholds = np.unique(X_column)
for thr in thresholds:
# calculate the information gain
gain = self._information_gain(y, X_column, thr)
if gain > best_gain:
best_gain = gain
split_idx = feat_idx
split_threshold = thr
return split_idx, split_threshold
Metadata
Metadata
Assignees
Labels
No labels