Is there a way to map a multi-variable structure onto a single range? I want to categorise variants of a structure made up of some number of variable components by mapping it to a unique range. Assume that the individual components all fall within the same base range.
I'm using color as an example for this question as its intuitive to think about but I don't want the question to be specific to that, its just a framework for understanding the problem.
Simple case:
Imagine I have a structure, called C made up of two values (r, b) (red and blue) and I want to categorise variants of C into distinct bands, things like &quot;very red&quot;, &quot;quite blue&quot;, &quot;slightly blue&quot;, &quot;quite red&quot; etc.
In this case I could just map the values by starting at 0 and then adding anything in the r channel and subtracting anything in the b channel, then I would get a final value in a 1 dimensional range somewhere between -1 and 1 (assuming the values for r and b are clamped. Then I could use this output value to categorise it into a band: maybe anything below -0.8 is &quot;very blue&quot; and a value between 0.4 and 0.5 is &quot;somewhat red&quot;.
Examples:
(0.1, 0.3) -&gt; -0.2
(1.0, 0.0) -&gt; 1.0
(0.2, 0.9) -&gt; -0.7
Not so simple:
However, if I introduce a third value, so C is made up of (r, b, g), I can't see how I can easily map this to a range which I can make assertions about, like &quot;bluey green&quot; or &quot;reddish blue&quot;. Trying to create a solution in code for this (naively) just ends with a complicated set of conditional statements.
One solution I thought might work would be to convert the 3D version of C into a point on a triangle expressed as a weighting of its vertices (where each vertex corresponds to one of C's components), and then convert that point in 2D coordinate space into a categorisation based on where it falls in a sub-shape - which is just a delimited area - on the triangle. So I could say, if the point falls inside this sub-shape on the triangle its &quot;bluey green&quot;, if the point falls inside this other sub-shape, then its &quot;reddish blue&quot; etc. However, this does seems like a fairly intricate solution and I'm not sure if I am heading down the wrong path.
Also, I can't see how this would then generalise to putting more and more variables into C.
I don't a have strong intuition for what field of mathematics or computer science I should be looking into to solve a problem like this or how exactly mapping like this work.
If anyone knows how to solve this or what sort of things I should be looking at to solve it, I would really appreciate some advice! Thanks.
If you want to solve this for colors, there are many techniques that are appropriate in that domain.  But you say you aren't really asking about colors, so I'll treat it as an analogy and try to give an answer that is more general (but wouldn't be what I would recommend for colors):
It sounds like you want to cluster the possible values into multiple clusters.  I would suggest you read about clustering algorithms. You'll need to pick a &quot;similarity measure&quot; that measures how similar two structures are.  That is domain-specific and not something we can tell you; you'll have to pick it based on your knowledge of the specific application domain.