Changeset 1336 for applications/robust/main.cpp
- Timestamp:
- 04/20/11 20:11:40 (13 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
applications/robust/main.cpp
r1331 r1336 134 134 vector<vector<string>> strings; 135 135 136 char* file_strings[3] = {"c:\\ar_ cauchy_single.txt", "c:\\ar_normal_single.txt","c:\\ar_student_single.txt"};136 char* file_strings[3] = {"c:\\ar_student_single.txt", "c:\\ar_student_single.txt","c:\\ar_cauchy_single.txt"}; 137 137 138 138 for(int i = 0;i<3;i++) … … 162 162 vector<vec> conditions; 163 163 //emlig* emliga = new emlig(2); 164 RARX* my_rarx = new RARX( 2,70);164 RARX* my_rarx = new RARX(3,20,true); 165 165 166 166 for(int k = 1;k<170;k++) … … 189 189 190 190 191 if(k> 5)191 if(k>10) 192 192 { 193 193 //my_rarx->posterior->step_me(0); 194 194 195 my_rarx->posterior->sample_mat(1); 196 195 mat samples = my_rarx->posterior->sample_mat(50); 196 197 197 198 cout << "MaxLik coords:" << my_rarx->posterior->minimal_vertex->get_coordinates() << endl; 198 199 199 ofstream myfile; 200 char fstring[80]; 201 strcpy(fstring,file_strings[j]); 202 strcat(fstring,"_res.txt"); 203 204 myfile.open(fstring,ios::app); 205 myfile << my_rarx->posterior->minimal_vertex->get_coordinates()[0]; 206 if(k!=strings[j].size()-1) 200 for(int s = 0;s<samples.rows();s++) 207 201 { 208 myfile << ","; 202 203 double avg_parameter = samples.get_row(s)*ones(samples.cols())/samples.cols(); 204 205 ofstream myfile; 206 char fstring[80]; 207 strcpy(fstring,file_strings[j]); 208 209 char es[5]; 210 strcat(fstring,itoa(s,es,10)); 211 212 strcat(fstring,"_res.txt"); 213 214 215 myfile.open(fstring,ios::app); 216 217 //myfile << my_rarx->posterior->minimal_vertex->get_coordinates()[0]; 218 myfile << avg_parameter; 219 220 if(k!=strings[j].size()-1) 221 { 222 myfile << ","; 223 } 224 else 225 { 226 myfile << endl; 227 } 228 myfile.close(); 209 229 } 210 else211 {212 myfile << endl;213 }214 myfile.close();215 230 } 216 231 }