MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / Decide

Method Decide

tensorflow/contrib/tensor_forest/kernels/v4/input_data.cc:57–82  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

55} // namespace
56
57bool TensorDataSet::Decide(const decision_trees::BinaryNode& node,
58 int example) const {
59 // TODO(gilberth): Support missing values.
60 float val = 0;
61 const auto& test = node.inequality_left_child_test();
62
63 if (test.has_oblique()) {
64 for (int i = 0; i < test.oblique().features_size(); ++i) {
65 val += test.oblique().weights(i) *
66 GetExampleValue(example, test.oblique().features(i));
67 }
68 } else {
69 val = GetExampleValue(example, test.feature_id());
70 }
71
72 if (node.has_inequality_left_child_test()) {
73 return DecideInequalityTest(node.inequality_left_child_test(), val);
74 } else {
75 decision_trees::MatchingValuesTest test;
76 if (node.custom_left_child_test().UnpackTo(&test)) {
77 return DecideMatchingValuesTest(test, val);
78 } else {
79 return false;
80 }
81 }
82}
83
84float TensorDataSet::GetExampleValue(
85 int example, const decision_trees::FeatureId& feature_id) const {

Callers 3

TESTFunction · 0.45
AddExampleMethod · 0.45
TraverseTreeMethod · 0.45

Calls 4

DecideInequalityTestFunction · 0.85
DecideMatchingValuesTestFunction · 0.85
feature_idMethod · 0.80
weightsMethod · 0.45

Tested by 1

TESTFunction · 0.36