src/ftable.cpp
//Q(f,.) = Feature value is the average of all entries that contain this feature
/*
 * Useful features: have one very useful action or several useful actions
 * Nonuseful features: have more useless than useful actions, no very useful actions.
 * */
Q(f,.) = Feature value is the average of all entries that contain this feature
Useful features: have one very useful action or several useful actions
Nonuseful features: have more useless than useful actions, no very useful actions.
Q ( f . ) = Feature value is the average of all entries that contain this feature Useful features : have one very useful action or several useful actions Nonuseful features : have more useless than useful actions no very useful actions .
double FTABLE::getFeatureValue(int feature){
	double max  = -Infinity;
    double total = 0.0;
    double val = 0.0;
    double exp = 2.0; 
	double totalPos = 0.0;
	double totalNeg = 0.0;
	double weightPos = 1.0;
	double weightNeg = 1.0;
	int count = 0;
    for(int i=0; i < Table.size(); i++) {
        if (Table[i].feature == feature) {
            if (Table[i].value.GetCount()) {
                val = Table[i].value.GetValue();
                if(val > 1) val = pow(val, exp);
                total += val;
            }
            else {
                total += FTABLE::NOACTION; 
            }
            count++;
        }
    }
    if(count > 0)
        total /= count;
	return total;
}
double FTABLE :: getFeatureValue ( int feature ) { double max = - Infinity ; double total = 0.0 ; double val = 0.0 ; double exp = 2.0 ; double totalPos = 0.0 ; double totalNeg = 0.0 ; double weightPos = 1.0 ; double weightNeg = 1.0 ; int count = 0 ; for ( int i = 0 ; i < Table . size ( ) ; i ++ ) { if ( Table [ i ] . feature == feature ) { if ( Table [ i ] . value . GetCount ( ) ) { val = Table [ i ] . value . GetValue ( ) ; if ( val > 1 ) val = pow ( val , exp ) ; total += val ; } else { total += FTABLE :: NOACTION ; } count ++ ; } } if ( count > 0 ) total /= count ; return total ; }
Q(f,.)
Q ( f . )
//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
	 * */ //If action hasn't been executed, penalize