Changeset 1366
- Timestamp:
- 05/10/11 18:59:52 (14 years ago)
- Location:
- applications/robust
- Files:
-
- 3 modified
Legend:
- Unmodified
- Added
- Removed
-
applications/robust/main.cpp
r1365 r1366 112 112 { 113 113 V0 = 0.01 * eye(ar_components.size()+2); 114 V0(0,0) = 0;114 V0(0,0) = 1; 115 115 my_arx->set_constant(true); 116 116 … … 120 120 121 121 V0 = 0.01 * eye(ar_components.size()+1); 122 V0(0,0) = 0;122 V0(0,0) = 1; 123 123 my_arx->set_constant(false); 124 124 … … 378 378 vector<vector<string>> strings; 379 379 380 char* file_string = "c:\\data ";380 char* file_string = "c:\\dataCDClosePercDiff"; 381 381 382 382 char dfstring[80]; … … 417 417 for(list<list<pair<int,int>>>::iterator model_type = model_types.begin();model_type!=model_types.end();model_type++) 418 418 { 419 models.push_back(new model((*model_type),true,false,30,0,&data_matrix)); 420 models.push_back(new model((*model_type),false,false,30,0,&data_matrix)); 419 models.push_back(new model((*model_type),true,true,100,0,&data_matrix)); 420 models.push_back(new model((*model_type),false,true,100,0,&data_matrix)); 421 models.push_back(new model((*model_type),true,false,100,0,&data_matrix)); 422 models.push_back(new model((*model_type),false,false,100,0,&data_matrix)); 421 423 } 422 424 423 425 mat result_lognc; 424 426 425 for(int time = max_model_order; 20;time++) //time<data_matrix.cols()427 for(int time = max_model_order;time<data_matrix.cols();time++) //time<data_matrix.cols() 426 428 { 427 429 vec cur_res_lognc; -
applications/robust/robustlib.cpp
r1365 r1366 145 145 base_vertex = (*base_ref); 146 146 147 //cout << "Base coords: " << base_vertex->get_coordinates() << endl; 148 //cout << "Condition: " << as_toprow->condition_sum << endl; 149 //pause(0.1); 147 /* 148 cout << "Base coords: " << base_vertex->get_coordinates() << endl; 149 cout << "Condition: " << as_toprow->condition_sum << endl; 150 pause(0.1); 151 */ 150 152 151 153 a_0 = -base_vertex->get_coordinates()*cur_condition+as_toprow->condition_sum[0]; … … 272 274 } 273 275 274 double gamma_multiplier = -(*as_ref).first-a_0; 275 276 double bracket = fact(as1_order-1)/pow(gamma_multiplier,sigma_order+1); 276 double cur_as_ref = (*as_ref).first; 277 278 double gamma_multiplier = -cur_as_ref-a_0; 279 280 double bracket = fact(as1_order-1)/pow(gamma_multiplier,sigma_order); 277 281 278 282 simplex->insert_gamma(0,bracket*multiplier,gamma_multiplier); … … 283 287 { 284 288 double local_bracket = 0; 285 double bracket_factor = 1/fact(as1_order-1-k)/pow(gamma_multiplier,sigma_order-k );//pow((double)-1,k+1)289 double bracket_factor = 1/fact(as1_order-1-k)/pow(gamma_multiplier,sigma_order-k-1);//pow((double)-1,k+1) 286 290 287 291 ivec control_vec = ivec(); … … 318 322 } 319 323 320 double correction_term_base = correction_term/pow(-a_0,sigma_order +1);324 double correction_term_base = correction_term/pow(-a_0,sigma_order); 321 325 322 326 simplex->insert_gamma(0,correction_term_base,-a_0); -
applications/robust/robustlib.h
r1365 r1366 22 22 using namespace itpp; 23 23 24 const double max_range = 5;//numeric_limits<double>::max()/10e-10;24 const double max_range = 10;//numeric_limits<double>::max()/10e-10; 25 25 26 26 /// An enumeration of possible actions performed on the polyhedrons. We can merge them or split them. … … 1087 1087 } 1088 1088 1089 log_nc = log(normalization_factor) + logfact(condition_order-number_of_parameters-2)-(condition_order-number_of_parameters-2)* 2;1089 log_nc = log(normalization_factor) + logfact(condition_order-number_of_parameters-2)-(condition_order-number_of_parameters-2)*log(2.0); 1090 1090 1091 1091 /* … … 1880 1880 // cout << "Normalization factor: " << normalization_factor << endl; 1881 1881 1882 log_nc = log(normalization_factor) + logfact(condition_order-number_of_parameters-2)-(condition_order-number_of_parameters-2)* 2;1882 log_nc = log(normalization_factor) + logfact(condition_order-number_of_parameters-2)-(condition_order-number_of_parameters-2)*log(2.0); 1883 1883 1884 1884 /* … … 2445 2445 int logfact(int factor) 2446 2446 { 2447 if(factor> 0)2448 { 2449 return factor+logfact(factor-1);2447 if(factor>1) 2448 { 2449 return log((double)factor)+logfact(factor-1); 2450 2450 } 2451 2451 else … … 2788 2788 this->has_constant = has_constant; 2789 2789 2790 posterior = new emlig(number_of_parameters,0.0 01);2790 posterior = new emlig(number_of_parameters,0.01); 2791 2791 2792 2792 this->window_size = window_size;