I need a function that takes in a vector of probabilities, a value and an index. the value is can be negative, 0 or positive, and can be of any absolute value.
it then adds the value to the probability in the index given inside the vector, and re scales it to sum up to one. the output vector has to be a probability distribution - so it has to still sum up to one, and include only values between 0 to 1.
one more important feature that I need is that of I add a positive value to a probability, the resulting probability will always be higher. if I add a negative value, it will always be smaller.
examples:
func([0.1,0.2,0.3,0.4], 0.1, 3) -- > [0.1, 0.2, 0.3, 0.5] --> something like: [0.08, 0.18, 0.28, 0.46]
so 0.4 went up, and all others went down.
func([0. ,0. ,0., 1.], 0.1, 3) -- > [0., 0., 0., 1.1] --> [0. ,0. ,0., 1.]
since no value van be higher than 1, it stayed the same
func([0. ,0. ,0., 1.], -0.1, 3) -- > [0., 0., 0., 0.9] --> something like: [0.02 ,0.02 ,0.02, 0.94]
here I used a negative value, so ind 3 went down.
I tried softmax, dividing by sum, dividing by (1/sum) and combinations of those, but nothing works as I need. any ideas?