📄 dtn_compute_1.cc
字号:
// file: dtn_likelihood_1.cc//// isip include files//#include "dt_node.h"#include "dt_node_constants.h"// method: compute_split_lk_inc_cc// // arguments:// State** states : all states associated with this node// float_4* occupy : state occupancy// int_4 num_feat : the number of features// Hash_table* answers : the hash table containing the answers// Question** questions : the array of all questions// float_4 occ_threshold : minimum occupancy required for children nodes// float_4& l_child_num_occ: the number of states occupancy of left child// float_4& r_child_num_occ: the number of states occupancy of right child// // return: a float_4 likelihood increase//float_4 Dt_node::compute_split_lk_inc_cc(Question** questions_a, Hash_table* answers_a, State** states_a, float_4* occupy_a, int_4 num_questions_a, int_4 num_feat_a, int_4 num_mix_a, int_4** l_context_a, int_4** r_context_a, float_4 occ_threshold_a, float_4& l_child_num_occ_a, float_4& r_child_num_occ_a) { Dt_node* tmp_l_node = new Dt_node(); Dt_node* tmp_r_node = new Dt_node(); float_4 l_likelihood; float_4 r_likelihood; find_opt_question_cc(questions_a, answers_a, states_a, occupy_a, l_context_a, r_context_a, occ_threshold_a, l_child_num_occ_a, r_child_num_occ_a, num_questions_a, num_feat_a, num_mix_a); // temporarily split the node using the optimal question // if(opt_question_d != (Question*)NULL) { split_node_cc(opt_question_d, answers_a, tmp_l_node, tmp_r_node, l_context_a, r_context_a); // compute the likelihood increase // l_likelihood = tmp_l_node->compute_likelihood_cc(states_a, occupy_a, num_feat_a, num_mix_a); r_likelihood = tmp_r_node->compute_likelihood_cc(states_a, occupy_a, num_feat_a, num_mix_a); if (l_child_num_occ_a > occ_threshold_a && r_child_num_occ_a > occ_threshold_a) { split_lk_inc_d = l_likelihood + r_likelihood - likelihood_d; } else { split_lk_inc_d = 0; } // set visit flag to show the split_likelihood has been computed // flag_visit_d = ISIP_TRUE; } // free memory // delete tmp_l_node; delete tmp_r_node; // exit gracefully // return split_lk_inc_d; }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -