Mathematical notation in a machine learning problem, majority rule

166 Views Asked by At

(I apologise that the title may be a bit confusing and I don't know if this is the right community to ask my question.)

This is a mathematical notation problem in the field of machine learning.

A little context:

In my machine learning problem, I want to classify an individual based on the samples I have of each individual (i.e. each person has multiple samples). Once I have made the prediction, I get the predicted class for each of the samples, but what I want is a global classification of the individual to one of the two classes. What I do is to count the number of samples that have been assigned to each class, and depending on this establishing a threshold, k, where an individual will be classified as Class 1 if the number of samples classified as Class 1 exceeds that threshold.

My problem is that I don't have much knowledge of formal mathematical writing, and I would like to translate the above into mathematical notation. I have written the following but I don't know if it is correct.

$$ Y=1, \sum_{i=0}^{n}\hat{y_{i}}\Leftrightarrow \hat{y_{i}}=1 > k\sum_{i=0}^{n}\hat{y_{i}} $$

where $\hat{y_{i}}$, denotes each individual element of the vector with the predictions for each sample.

In summary, what I want to write is: The individual will be assigned to class 1 if, the number of samples classified as '1' is greater than k times the total number of samples of the individual.

2

There are 2 best solutions below

0
On BEST ANSWER

As requested in comments:

Assuming that the other class is $0$ so $\sum \hat{y}_i$ is simply the number of class $1$ predictions for that individual, you could use an indicator function such as $$\hat{Y} = \mathbf{1}_{\left[\sum \hat{y}_i >k\right]}$$

If you wanted $k$ to be a proportion threshold rather a count, you could have something like $$\hat{Y} = \mathbf{1}_{\left[\sum \hat{y}_i >kn\right]}$$

If you wanted to say this was for individual $j$ but with proportion $k$ constant across individuals you could add a further subscript, with $$\hat{Y_j} = \mathbf{1}_{\left[\sum_i \hat{y}_{i,j} >kn_j\right]}$$

Some readers might still welcome an explanation in words.

4
On

How about the function $$ \hat y=\frac{\max(0,N_1-k)}{N_1-k} $$where $N_1≤N≠k$ denotes the number of samples classified as class 1 and $k<N$ as the threshold.

Edit: I've modified the numerator and denominator in regards to the comment of @Henry in the case of $N_1=k$. If you want to classify the features as $1$ you can follow Henry's advice and use $\hat k=k-1/2$.

If you want to classify the features as $0$ then you use $\hat k = k +1/2$