Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions xbooster/lgb_constructor.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,13 +190,12 @@ def get_leafs(

# For margin output, get raw scores per tree
# Each tree's prediction is returned as-is (no base_score adjustment needed)
df_leafs = pd.DataFrame()

tree_results = []
for i in range(n_trees):
df_leafs[f"tree_{i}"] = self.model.predict(
X, raw_score=True, start_iteration=i, num_iteration=1
)
res = self.model.predict(X, raw_score=True, start_iteration=i, num_iteration=1)
tree_results.append(res)

df_leafs = pd.DataFrame(np.column_stack(tree_results), index=X.index, columns=_colnames)
return df_leafs

def extract_leaf_weights(self) -> pd.DataFrame:
Expand Down
Loading