return np.array(order_of_each_bag)
def predict(self, predictions):
non_null_weights = (weight for weight in self.weights_ if weight > 0)
for i, weight in enumerate(non_null_weights):
predictions[i] *= weight
return np.sum(predictions, axis=0)
After Change
return np.array(order_of_each_bag)
def predict(self, predictions):
predictions = np.asarray(predictions)
// if predictions.shape[0] == len(self.weights_),
// predictions include those of zero-weight models.
if predictions.shape[0] == len(self.weights_):