MCPcopy Create free account
hub / github.com/antmachineintelligence/mtgbmcode / add

Method add

python-package/lightgbmmt/basic.py:2667–2680  ·  view source on GitHub ↗

Recursively add thresholds.

(root)

Source from the content-addressed store, hash-verified

2665 If ``xgboost_style=True``, the histogram of used splitting values for the specified feature.
2666 """
2667 def add(root):
2668 """Recursively add thresholds."""
2669 if 'split_index' in root: # non-leaf
2670 if feature_names is not None and isinstance(feature, string_type):
2671 split_feature = feature_names[root['split_feature']]
2672 else:
2673 split_feature = root['split_feature']
2674 if split_feature == feature:
2675 if isinstance(root['threshold'], string_type):
2676 raise LightGBMError('Cannot compute split value histogram for the categorical feature')
2677 else:
2678 values.append(root['threshold'])
2679 add(root['left_child'])
2680 add(root['right_child'])
2681
2682 model = self.dump_model()
2683 feature_names = model.get('feature_names')

Callers 9

_lazy_initMethod · 0.80
get_ref_chainMethod · 0.80
trainFunction · 0.80
cvFunction · 0.80
mainFunction · 0.80
mainFunction · 0.80
mainFunction · 0.80
mainFunction · 0.80
write_to_diskMethod · 0.80

Calls 3

LightGBMErrorClass · 0.85
addFunction · 0.85
appendMethod · 0.80

Tested by

no test coverage detected