Search code examples
machine-learningclassification

Classification techniques for continuous arrays as inputs and scalar categorical variable as output


Suppose for a given data set: T’s and Y’s are arrays with T = [0 1 2 3 5 6 7] Y= [4 7 9 3 6 1] So at T=0, Y=4 and so on Z = [Red] with just one element in Z. T and Y are continuous inputs. Z discrete (can be either red or yellow).

Another given set: T = [1 3 4 9 3] Y= [4 9 2 1 6] Z=[Yellow]

Suppose I have many similar sets, what classification techniques can I use to explore relations which take T and Y as continuous array inputs and outputs categorical Z of single element?

I am a bit confused as the inputs themselves are arrays whereas the output is just a single element


Solution

  • Getting the output of a model into classification of categorical output is itself just a function that is placed at the end the model's raw output. A pretty neat little "trick" that a lot of people who are learning or just playing around may not notice.

    Machine Learning boils down to finding ways to represent your data such that a Machine can read it, otherwise how can it learn? This means it needs to be in numbers.

    Using your case, you model will be told that the two input features are T and Y, already numbers, great! But the output is a categorical value, so we need to adjust what the machine thinks these are. Since we have two options, we can say Red=0, and Yellow=1.

    There you go, now your model knows how to spit out the result, you would train it using these adjustments, and when the model spits out an answer of 1, you then add an extra function at the end that automatically knows that Yellow=1, the model doesn't have to know.

    In practice, it actually should return 2 numbers. What is essentially a prediction for the likelihood of each of the colours that would add to 1. So the output of the model would be [0.25,0.75], and then we can say the model was more confident that it was Yellow, so we take that as the prediction.

    By doing it this way, you've boiled everything down to numbers, and so the technique is up to you. In reality, the data distributions and the type of task (here it is a binary classification task, because only 2 output options) would affect which techniques are going to be the most affective or practical.