Function Design: 6-Output Mapper Functions

Posted
Comments None

Mapper functions with 6 discrete outputs is as high as I'll go (I still have to implement all of them in all the programming languages of GeneXproTools). Although they continue to scale up amazingly well, with hardly any loss in performance compared to the mapper functions of 4 and 5 outputs (see the posts "Function Design: 4-Output Mapper Functions" and "Function Design: 5-Output Mapper Functions"), I don't think we'll benefit from higher order output functions to solve multi-class classification problems with more than 3 classes, unless the problems are really simple such as the 3-class Iris problem.

I must confess that I couldn't find even a toy problem to test effectively these higher order mappers on them. For example, not even the Balance Scale data, a well-known toy problem, can be satisfactorily solved in one go with these functions (and also the argmin/argmax functions of 4 arguments) using the current setup. Other tools are obviously needed, such as special fitness functions, linking structures and sampling schemes, just to name a few.

But these functions are nonetheless interesting and very useful on their own and, meshed with other functions, they can impact positively on the evolution of all kinds of models.

So here it is, the C++ code for the 6-output mapper functions of 2, 3, and 4 arguments. Again, there are 3 new functions in the series – Map6A, Map6B, and Map6C – respectively with 2, 3, and 4 arguments. And their performance is again exceptional with 98% hits for Map6A, 98% for Map6B, and 99% for Map6C against 96% for the argmax.  

    // Map6A(x0,x1): 6-Output Mapper Function
    const double SLACK = 10.0;
    double output = 0.0;
    if (x[1] < (x[0] - SLACK))
        output = 0.0;
    else if (x[1] >= (x[0] - SLACK) && x[1] < (x[0] - SLACK/2.0))
        output = 1.0;
    else if (x[1] >= (x[0] - SLACK/2.0) && x[1] < x[0])
        output = 2.0;
    else if (x[1] >= x[0] && x[1] < (x[0] + SLACK/2.0))
        output = 3.0;
    else if (x[1] >= (x[0] + SLACK/2.0) && x[1] < (x[0] + SLACK))
        output = 4.0;
    else if (x[1] >= (x[0] + SLACK))
        output = 5.0;
    return output;


    // Map6B(x0,x1,x2): 6-Output Mapper Function
    // evaluate min(x,y), max(x,y), midrange, midpoint1, midpoint2
    double min = x[0];
    double max = x[1];
    if (min > x[1])
    {
        min = x[1];
        max = x[0];
    }
    double midrange = (min + max)/2.0;
    double midpoint1 = (min + midrange)/2.0;
    double midpoint2 = (midrange + max)/2.0;
    double output = 0.0;
    if (x[2] < min)
        output = 0.0;
    else if (x[2] >= min && x[2] < midpoint1)
        output = 1.0;
    else if (x[2] >= midpoint1 && x[2] < midrange)
        output = 2.0;
    else if (x[2] >= midrange && x[2] < midpoint2)
        output = 3.0;
    else if (x[2] >= midpoint2 && x[2] < max)
        output = 4.0;
    else if (x[2] >= max)
        output = 5.0;
    return output;

 

    // Map6C(x0,x1,x2,x3): 6-Output Mapper Function
    // evaluate min(x,y,z), max(x,y,z), midleValue(x,y,z), midrange1, midrange2
    //
    // evaluate min(x,y,z)
    double min = x[0];
    int argmin = 0;
    if (min > x[1])
    {
        min = x[1];
        argmin = 1;
    }
    if (min > x[2])
    {
        min = x[2];
        argmin = 2;
    }
    // evaluate max(x,y,z)
    double max = x[0];
    int argmax = 0;
    if (max < x[1])
    {
        max = x[1];
        argmax = 1;
    }
    if (max < x[2])
    {
        max = x[2];
        argmax = 2;
    }
    // evaluate midleValue(x,y,z)
    double midleValue = x[2];
    if (0 != argmin && 0 != argmax)
        midleValue = x[0];
    if (1 != argmin && 1 != argmax)
        midleValue = x[1];
    // evaluate midrange1 e midrange2
    double midrange1 = (min + midleValue)/2.0;
    double midrange2 = (midleValue + max)/2.0;

    double output = 0.0;
    if (x[3] < min)
        output = 0.0;
    else if (x[3] >= min && x[3] < midrange1)
        output = 1.0;
    else if (x[3] >= midrange1 && x[3] < midleValue)
        output = 2.0;
    else if (x[3] >= midleValue && x[3] < midrange2)
        output = 3.0;
    else if (x[3] >= midrange2 && x[3] < max)
        output = 4.0;
    else if (x[3] >= max)
        output = 5.0;
    return output;

In the next post we'll go the other direction and take a look at the 3-output mapper functions of 2, 3, and 4 arguments, the last in the series of new mapper functions.

 

Author

Comments

There are currently no comments on this article.

Comment

your_ip_is_blacklisted_by sbl.spamhaus.org

← Older Newer →