Commits

Yiliang Xiong committed a7eb8fe

define global settings

Comments (0)

Files changed (4)

 // run all the datasets
 
+// define global settings
 global replace_all = 1
+global max_iter = 50
+global LL_gap = 10
+global nc = 5
 
 ** 1 **
 global dataset_size = 1
 set matsize 5000
 set more off
 capture log close
-log using binary_logit_$N.log, replace
+log using binary_logit_nc$nc_$N.log, replace
 set seed 314159265
 
 // load train profiles
 // demographic variables
 global user_demo "age sex num_tweet"
 
-// number of laent classes
-global nc = 2
-
 // define the dependent and independent variables
 global y obs_choice
 global X key_wei_sum $cat_indx
 // initialize log likelihood value
 global LL0 = 0
 global LL1 = 100
-global max_iter = 5
-global LL_gap = 1.0
 local k = 0
 
 ** iteration starts **
 drop if dummy_alt
 
 // save estimation results
-save track1/rec_log_result_$N.dta, replace
+save track1/rec_log_result_nc$nc_$N.dta, replace
 log close
 // define all the global macros here
 
+capture macro list nc 
+if _rc {
+	// number of laent classes
+	global nc = 2
+}
+
+capture macro list max_iter
+if _rc {
+	global max_iter = 5
+}
+
+capture macro list LL_gap
+if _rc {
+	global LL_gap = 1.0
+}
+
 capture macro list replace_all
 if _rc {
 	// default action: replace all the existing files

predict_choice.do

 capture log close
-log using predict_choice_$N.log, replace
+log using predict_choice_nc$nc_$N.log, replace
 
 // load estimation results
 // use track1/rec_log_result_$N.dta, clear
 sort original_order
 
 // print to a csv file
-outsheet user_id top3_items using track1/rec_log_ranking_$N.csv if tag_all_user, comma replace
+outsheet user_id top3_items using track1/rec_log_ranking_nc$nc_$N.csv if tag_all_user, comma replace
 
 // save item rankings
-save track1/rec_log_ranking_$N.dta, replace
+save track1/rec_log_ranking_nc$nc_$N.dta, replace
 log close