File tree Expand file tree Collapse file tree 2 files changed +16
-3
lines changed Expand file tree Collapse file tree 2 files changed +16
-3
lines changed Original file line number Diff line number Diff line change @@ -378,7 +378,10 @@ def _importances(node: Node):
378
378
# require the tree to have more than 1 node, otherwise just leave importance_data_tree as zeros
379
379
if 1 < next (node_counter ):
380
380
tree_samples = _importances (tree_ )
381
- importance_data_tree /= tree_samples
381
+ if tree_samples != 0 :
382
+ importance_data_tree /= tree_samples
383
+ else :
384
+ importance_data_tree = 0
382
385
383
386
importance_data .append (importance_data_tree )
384
387
Original file line number Diff line number Diff line change @@ -183,11 +183,21 @@ def __repr__(self):
183
183
184
184
185
185
class HSTreeRegressor (HSTree , RegressorMixin ):
186
- ...
186
+ def __init__ (self , estimator_ : BaseEstimator = DecisionTreeRegressor (max_leaf_nodes = 20 ),
187
+ reg_param : float = 1 , shrinkage_scheme_ : str = 'node_based' ):
188
+ super ().__init__ (estimator_ = estimator_ ,
189
+ reg_param = reg_param ,
190
+ shrinkage_scheme_ = shrinkage_scheme_ ,
191
+ )
187
192
188
193
189
194
class HSTreeClassifier (HSTree , ClassifierMixin ):
190
- ...
195
+ def __init__ (self , estimator_ : BaseEstimator = DecisionTreeClassifier (max_leaf_nodes = 20 ),
196
+ reg_param : float = 1 , shrinkage_scheme_ : str = 'node_based' ):
197
+ super ().__init__ (estimator_ = estimator_ ,
198
+ reg_param = reg_param ,
199
+ shrinkage_scheme_ = shrinkage_scheme_ ,
200
+ )
191
201
192
202
193
203
def _get_cv_criterion (scorer ):
You can’t perform that action at this time.
0 commit comments