0

I'm sorry if this is badly explained, I'm really a computer programmer. I have 13 different variables all initially assigned to a integer of 0.5.

thr = 0.5 act = 0.5 com = 0.5

I want to generate a function in which a user can input a number from 1-10 and it'll increase the variable.

E.g. ThrInput = 4 Thr is now reduced by a small amount.

ActInput = 9 Act is now increase by a large amount.

The must never exceed 1 due to this number being used as a probability elsewhere. I also need the function to be able to increase by less the closer it gets to 1 or 0 (Logarithmic pattern).

Any help would be much appreciated,

Regards,

Matt.


Reasoning behind it is, a user can rate a movie with a genre (increasing or decreasing the chance of getting that genre movie show again) but never want the probability to hit 1 or 0 because that means that means that genre will either be 100% of all movies or 0%.

  • Sorry, this is not at all clear. You say you have $13$ variables but you list only $3$. You talk about increasing a variable but in your first example you say the variable is decreased. What exactly do you want your function to do? – lulu Apr 05 '19 at 21:05
  • Hi, sorry it's difficult for me to explain. Just imagine 1 variable, due to the fact they'd all have the same function. The variable starts on 0.5 and the higher the number the higher probability it is to show up in a list (0 < x < 1). The user has a input can input a number from 1 to 10 as many times as they wish. So, if the user put the number 9 in the 0.5 the number would increase drastically but the number's exponentially decreases the higher/lower it gets. As shown in this diagram. https://prnt.sc/n8491m – Matt Robinson Apr 05 '19 at 21:34
  • 0.5 is not an integer. – user Apr 05 '19 at 21:56

1 Answers1

0

Try the following function: $$ f(x)=\frac1{1+e^{a(x-\bar x)}}, $$ where $\bar x$ is the mean input value (in your case $5.5$) and $a>0$ is an adjustable parameter. The larger is the parameter the closer will be the result to $0$ (for $x_\text{min}\le x< \bar x$) or to $1$ (for $\bar x< x\le x_\text{max}$). Observe the symmetry wrt. the value $x=\bar x$. If you would like to use even number of equally spaced possible inputs (as in the case $x=1\dots10$) there is no symmetric choice of input for the mean value $f(x)=0.5$. For odd number of inputs (for example $x=0\dots10$) it is easily possible.

user
  • 26,272