Show
Ignore:
Timestamp:
02/21/11 09:22:08 (13 years ago)
Author:
sindj
Message:

Prvni pokusy s robustnim AR modelem. JS

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • applications/robust/robustlib.cpp

    r1281 r1282  
    11#include "robustlib.h" 
     2 
    23 
    34void polyhedron::triangulate(bool should_integrate) 
     
    3334        double toprow::integrate_simplex(set<vertex*> simplex, char c) 
    3435        { 
    35                 // cout << ((toprow*)this)->condition << endl; 
    36                  
     36                // cout << ((toprow*)this)->condition << endl;           
     37 
    3738                int condition_order = ((toprow*)this)->condition_order-2; // -2 by bylo, pokud chceme uniformni apriorno 
    3839 
     
    4546                { 
    4647 
    47                         cout << endl; 
    48                         cout << ((toprow*)this)->condition << endl; 
    49                         cout << "C:" << condition_order+2 << "  N:" << my_emlig->number_of_parameters << "  C+N:" << condition_order-my_emlig->number_of_parameters+2 << endl; 
     48                        //cout << endl; 
     49                        //cout << ((toprow*)this)->condition << endl; 
     50                        //cout << "C:" << condition_order+2 << "  N:" << my_emlig->number_of_parameters << "  C+N:" << condition_order-my_emlig->number_of_parameters+2 << endl; 
     51                         
    5052 
    5153                        emlig* current_emlig; 
     
    8486                                base_vertex = (*base_ref); 
    8587 
    86                                 cout << "Base coords:" << base_vertex->get_coordinates() << endl; 
     88                         
     89                                //cout << endl << "Base coords:" << base_vertex->get_coordinates() << endl; 
    8790 
    8891                                a_0 = base_vertex->get_coordinates()*cur_condition-as_toprow->condition[0]; 
     92                                 
    8993 
    9094                                int row_count = 0; 
     
    111115 
    112116                                                        break; 
    113                                                 } 
    114                                                  
     117                                                }                                                
     118                                                 
     119                                                 
     120 
     121                                                if(a_0<current_emlig->likelihood_value) 
     122                                                { 
     123                                                        current_emlig->minimal_vertex = base_vertex; 
     124                                                        current_emlig->likelihood_value = a_0; 
     125                                                } 
     126 
     127                                                double a_m = (*vert_ref)->get_coordinates()*cur_condition-as_toprow->condition[0]; 
     128                                                if(a_m<current_emlig->likelihood_value) 
     129                                                { 
     130                                                        current_emlig->minimal_vertex = (*vert_ref); 
     131                                                        current_emlig->likelihood_value = a_m;                                           
     132                                                } 
     133 
     134                                                //cout << "a0:" << a_0 << " a0 coords:" << base_vertex->get_coordinates() << " am:" << a_m << " am coords:" << (*vert_ref)->get_coordinates() << endl; 
     135 
    115136                                                //cout << "Absolute coords:(V"  << row_count << ")" << (*vert_ref)->get_coordinates() << endl; 
    116                                                 cout << "Relative coords:(V"  << row_count << ")" << relative_coords << endl; 
     137                                                //cout << "Relative coords:(V"  << row_count << ")" << relative_coords << endl; 
    117138 
    118139                                                pair<map<double,int>::iterator,bool> returned = as.insert(pair<double,int>(new_a,1)); 
     
    136157                        while(!order_correct); 
    137158                         
     159                        /* 
    138160                        cout << "a_0: " << a_0 << "    "; 
    139161                        int as_count = 1; 
     
    142164                                cout << "a_" << as_count << ": " << (*as_ref).first << "    "; 
    143165                                as_count++; 
    144                         } 
     166                        }*/ 
    145167 
    146168                        double int_value = 0; 
     
    224246                 
    225247 
    226                         cout << "Probability:" << int_value << endl; 
     248                        //cout << "Probability:" << int_value << endl; 
    227249                         
    228250                        return int_value;