Skip to content

Commit

Permalink
Fix _VotingBooster
Browse files Browse the repository at this point in the history
  • Loading branch information
Y-oHr-N committed Feb 20, 2020
1 parent 685d8d9 commit f3996fe
Showing 1 changed file with 6 additions and 16 deletions.
22 changes: 6 additions & 16 deletions optgbm/sklearn.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,25 +249,15 @@ def from_representations(

return cls(boosters, weights=weights)

def predict(
self, X: TWO_DIM_ARRAYLIKE_TYPE, **kwargs: Any
) -> TWO_DIM_ARRAYLIKE_TYPE:
results = []

for b in self.boosters:
result = b.predict(X, **kwargs)

results.append(result)

return np.average(results, axis=0, weights=self.weights)

def feature_importance(self, **kwargs: Any) -> np.ndarray:
results = []
results = [b.feature_importance(**kwargs) for b in self.boosters]

for b in self.boosters:
result = b.feature_importance(**kwargs)
return np.average(results, axis=0, weights=self.weights)

results.append(result)
def predict(
self, X: TWO_DIM_ARRAYLIKE_TYPE, **kwargs: Any
) -> TWO_DIM_ARRAYLIKE_TYPE:
results = [b.predict(X, **kwargs) for b in self.boosters]

return np.average(results, axis=0, weights=self.weights)

Expand Down

0 comments on commit f3996fe

Please sign in to comment.