MCPcopy Create free account
hub / github.com/apache/madlib / run

Method run

src/modules/recursive_partitioning/decision_tree.cpp:50–86  ·  view source on GitHub ↗

------------------------------------------------------------ functions ------------------------------------------------------------

Source from the content-addressed store, hash-verified

48// functions
49// ------------------------------------------------------------
50AnyType
51initialize_decision_tree::run(AnyType & args){
52 DecisionTree<MutableRootContainer> dt = DecisionTree<MutableRootContainer>();
53 bool is_regression_tree = args[0].getAs<bool>();
54 std::string impurity_func_str = args[1].getAs<std::string>();
55 uint16_t n_y_labels = args[2].getAs<uint16_t>();
56 uint16_t max_n_surr = args[3].getAs<uint16_t>();
57
58 if (is_regression_tree)
59 n_y_labels = REGRESS_N_STATS;
60 dt.rebind(1u, n_y_labels, max_n_surr, is_regression_tree);
61 dt.feature_indices(0) = dt.IN_PROCESS_LEAF;
62 dt.feature_thresholds(0) = 0;
63 dt.is_categorical(0) = 0;
64 if (max_n_surr > 0){
65 dt.surr_indices.setConstant(dt.SURR_NON_EXISTING);
66 dt.surr_thresholds.setConstant(0);
67 dt.surr_status.setConstant(0);
68 }
69 dt.predictions.row(0).setConstant(0);
70
71 dt.is_regression = is_regression_tree;
72 if (dt.is_regression){
73 dt.impurity_type = dt.MSE; // only MSE defined for regression
74 } else {
75 if ((impurity_func_str.compare("misclassification") == 0) ||
76 (impurity_func_str.compare("misclass") == 0))
77 dt.impurity_type = dt.MISCLASS;
78 else if ((impurity_func_str.compare("entropy") == 0) ||
79 (impurity_func_str.compare("cross-entropy") == 0))
80 dt.impurity_type = dt.ENTROPY;
81 else
82 dt.impurity_type = dt.GINI; // default impurity for classification
83 }
84
85 return dt.storage();
86 } // initialize_decision_tree
87// ------------------------------------------------------------
88
89////////////////////////////////////////////////////////////////

Callers

nothing calls this directly

Calls 15

NullFunction · 0.85
prune_treeFunction · 0.85
make_cp_listFunction · 0.85
transverse_treeFunction · 0.85
transverse_tree_threshFunction · 0.85
fill_one_rowFunction · 0.85
expandMethod · 0.80
expand_by_samplingMethod · 0.80
pickSurrogatesMethod · 0.80
predict_responseMethod · 0.80
displayMethod · 0.80
surr_displayMethod · 0.80

Tested by

no test coverage detected