0
$\begingroup$

I have a vector of length $n \gt 4$ which has exactly 4 targets, so for example [0, 0, 0, 1, 0, 1, 0, 1, 1]. I would like to know how I can modify the softmax function for this case. Usually, it is normalized so that all probabilities sum to 1. In my case, all the probabilities will need to sum to 4 -- is there any way to do this?

$\endgroup$
0

1 Answer 1

0
$\begingroup$

If I understand your question correctly, you are trying to find a function that "normalizes"/scales every vector to a vector with norm 4?

Usually, you could scale your vector with any feature-scaling method (see wikipedia for more details). After you have normalized this simply multiply it with 4 to rescale the normalized vectors.

I hope this is what you were looking for.

$\endgroup$
2
  • $\begingroup$ Wouldn't there be the possibility that the probabilities could be greater than 1 with this scaling? $\endgroup$
    – Dennis
    Jul 21, 2021 at 18:39
  • $\begingroup$ could you please specify the requirement you have to the scaling? Sum should be 4 while the individual nodes cant be larger then 1? Also only 4 entries should be non-zero? If so: just take the four largest entries, set them to 1, everything else to zero. $\endgroup$
    – Jost A.
    Jul 22, 2021 at 9:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.