@@ -114,13 +114,13 @@ def __init__(self, voting_strategy="soft", **kwargs):
114
114
def forward (self , * x ):
115
115
116
116
outputs = [
117
- F .softmax (estimator (* x ), dim = 1 ) for estimator in self .estimators_
117
+ F .softmax (op .unsqueeze_tensor (estimator (* x )), dim = 1 )
118
+ for estimator in self .estimators_
118
119
]
119
120
120
121
if self .voting_strategy == "soft" :
121
122
proba = op .average (outputs )
122
-
123
- elif self .voting_strategy == "hard" :
123
+ else :
124
124
proba = op .majority_vote (outputs )
125
125
126
126
return proba
@@ -309,7 +309,7 @@ def predict(self, *x):
309
309
310
310
311
311
@torchensemble_model_doc (
312
- """Implementation on the NeuralForestClassifier.""" , "tree_ensmeble_model "
312
+ """Implementation on the NeuralForestClassifier.""" , "tree_ensemble_model "
313
313
)
314
314
class NeuralForestClassifier (BaseTreeEnsemble , VotingClassifier ):
315
315
def __init__ (self , voting_strategy = "soft" , ** kwargs ):
@@ -324,7 +324,8 @@ def __init__(self, voting_strategy="soft", **kwargs):
324
324
def forward (self , * x ):
325
325
# Average over class distributions from all base estimators.
326
326
outputs = [
327
- F .softmax (estimator (* x ), dim = 1 ) for estimator in self .estimators_
327
+ F .softmax (op .unsqueeze_tensor (estimator (* x )), dim = 1 )
328
+ for estimator in self .estimators_
328
329
]
329
330
proba = op .average (outputs )
330
331
@@ -561,7 +562,7 @@ def predict(self, *x):
561
562
562
563
563
564
@torchensemble_model_doc (
564
- """Implementation on the NeuralForestRegressor.""" , "tree_ensmeble_model "
565
+ """Implementation on the NeuralForestRegressor.""" , "tree_ensemble_model "
565
566
)
566
567
class NeuralForestRegressor (BaseTreeEnsemble , VotingRegressor ):
567
568
@torchensemble_model_doc (
0 commit comments