Skip to content

Commit 9a93430

Browse files
authored
Update utils.py
1 parent 898cf5f commit 9a93430

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

charpter12_XGBoost/utils.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ def feature_split(X, feature_i, threshold):
1313

1414
return np.array([X_left, X_right])
1515

16+
1617
### 计算基尼指数
1718
def calculate_gini(y):
1819
y = y.tolist()
@@ -34,4 +35,4 @@ def cat_label_convert(y, n_col=None):
3435
n_col = np.amax(y) + 1
3536
one_hot = np.zeros((y.shape[0], n_col))
3637
one_hot[np.arange(y.shape[0]), y] = 1
37-
return one_hot
38+
return one_hot

0 commit comments

Comments
 (0)