src/ftable.cpp
/*
 *  getAllFeatureValues v2.0:
 *      Traverse the table only once, adding all weighted feature values and pushing them in fvalues.
 *      Equivalent but much more efficient than old version.
 */
getAllFeatureValues v2.0:
Traverse the table only once, adding all weighted feature values and pushing them in fvalues.
Equivalent but much more efficient than old version.
getAllFeatureValues v2 . 0 : Traverse the table only once adding all weighted feature values and pushing them in fvalues . Equivalent but much more efficient than old version .
void FTABLE::getAllFValues(std::vector<double>& fvalues){
    std::vector<FVALUE> f_vals(NumFeatures);
    double val = 0.0;
    double exp = 2.0; 
    for(auto fv : f_vals) fv.Set(0,0);
    int f = 0;
    for(auto E : Table){
        f = E.feature;
        val = 0.0;
        if(E.value.GetCount()) {
            val = E.value.GetValue(); 
            if(val > 0) val = pow(val, exp); 
        }
        else val = FTABLE::NOACTION; 
        f_vals[f].Add(val); 
    }
    for(auto fv : f_vals)
        fvalues.push_back(fv.GetValue());
}
void FTABLE :: getAllFValues ( std :: vector < double > & fvalues ) { std :: vector < FVALUE > f_vals ( NumFeatures ) ; double val = 0.0 ; double exp = 2.0 ; for ( auto fv : f_vals ) fv . Set ( 0 , 0 ) ; int f = 0 ; for ( auto E : Table ) { f = E . feature ; val = 0.0 ; if ( E . value . GetCount ( ) ) { val = E . value . GetValue ( ) ; if ( val > 0 ) val = pow ( val , exp ) ; } else val = FTABLE :: NOACTION ; f_vals [ f ] . Add ( val ) ; } for ( auto fv : f_vals ) fvalues . push_back ( fv . GetValue ( ) ) ; }
getAllFeatureValues v2.0:
      Traverse the table only once, adding all weighted feature values and pushing them in fvalues.
getAllFeatureValues v2 . 0 : Traverse the table only once adding all weighted feature values and pushing them in fvalues .
//Exponent to poly side of value function /* Linear negative + poly positive
	 *
	 *  Negative values are simply added, unused actions are punished (NOACTION)
	 *  and positive values are amplified exponentially/polynomially
	 * */ //Negative values are preserved //Positive values are amplified //If action hasn't been executed, penalize //Finally, add value to corresponding feature