Function Design: New 3-6 Output Functions

Posted
Comments None

Sometimes the inspiration comes from the least expected places. I had been working on the Logic Synthesis documentation, updating the tutorials with new images and content. For a couple of weeks I lived and breathed Boolean logic. And in those situations I always end up discovering new interesting things (even if they are new only to me).

I was still under the influence of logic when I started working on this new project. And one of the things that always leaves a long impression when I work with the multiplexer functions is their structure. This time I could even get a glimpse at their structure with the new Variable Importance Chart of GeneXproTools. And I was mesmerized! There it was: The first 3 inputs of the 11-multiplexer are the most important and they determine the address!



Are you seeing where I'm going with this? I can use the same idea to design 4-6 output classifier functions of 2, 3, 4,… n arguments!

For functions of 2 arguments I can use the first argument to determine the intervals for the second (3, 4, 5, 6,… n intervals, but I'm limiting this to 6). For functions of 3 arguments I can use the first 2 arguments to map the third argument to a series of intervals, and similarly for functions of 4 arguments.

And there's yet another way of creating classifier functions exploring the same idea! For example, for functions of 3 arguments we can use the first argument to determine the anchoring point for the remaining 2 arguments and design more powerful functions of 3 arguments with properties similar to the BUY-SELL-WAIT function described in the post "Function Design: The BUY-SELL-WAIT Function" and the 3-output classifier functions described in the post "Function Design: More 3-Output Classifier Functions".

And similarly for functions of 4 arguments: we can use the first 2 arguments to generate the map for the last 2 arguments and create more flexible functions similar to the CL2B function described in the post "Function Design: More 3-Output Classifier Functions".

And what's really interesting is that I wasn't wrong about their potential! These functions are indeed special: some are better than others, but they all are comparable to the argmin/argmax functions (see my previous post where I describe how I'm measuring performance)!

So I'm giving the first class of functions a name of their own. I'm calling them Mapper Functions and representing them by Map3A, Map4A, Map5A, Map6A, … and so on in GeneXproTools (again, the numeral represents the number of discrete outputs and the big letter represents the order, A, B, C,… etc.).

As for the second class, they aren't really mapper functions because they don't map particular intervals to specific outputs. But they do use some of the arguments to encode anchoring points that are used to make decisions about the output. Since they have some affinity with the 3-output classifier functions described in the posts "Function Design: The BUY-SELL-WAIT Function" and "Function Design: More 3-Output Classifier Functions", I'm calling them Elastic Classifier Functions and representing them by ECL3A, ECL3B… in GeneXproTools.

Just to give you a flavor of the structure of these functions, I'm including here the C++ code of the very first mapper function that I implemented and tested, the 4-output mapper function of 3 arguments:

    // Map4B(x0,x1,x2): 4-Output Mapper Function
    // evaluate min(x0,x1), max(x0,x1) and midrange
    double min = x[0];
    double max = x[1];
    if (min > x[1])
    {
        min = x[1];
        max = x[0];
    }
    double midrange = (max + min)/2.0;
    
    double output = 0.0;
    if (x[2] < min)
        output = 0.0;
    if (x[2] >= min && x[2] < midrange)
        output = 1.0;
    if (x[2] >= midrange && x[2] < max)
        output = 2.0;
    if (x[2] >= max)
        output = 3.0;
    return output;

This function performs better than the argmax(x0,x1,x2,x3) (98% hits vs 96%) and has the additional advantage that it only needs 3 arguments! We can design similar mapper functions with 2, 3 and 4 arguments (I'm limiting myself to 4 because of the current max arity constraint of the built-in math functions of GeneXproTools, but you can extend this to any number of arguments) and with the number of discrete outputs that we need (I decided not to go beyond 6 because I have to add code for all these functions in all the 17 programming languages that GeneXproTools supports, but you can experiment with any number of outputs using, for example, the Custom Math Functions of GeneXproTools).

Over the next posts I'll give you the code for all these new mappers and elastic classifiers with some numerical evidence of their performance.

Author

Comments

There are currently no comments on this article.

Comment

Enter your comment below. Fields marked * are required. You must preview your comment first before finally posting.





← Older Newer →