How can I change the slope of the sigmoid function?

Greetings, I have a question about the slope of the sigmoid function.
I’m trying to use the sigmoid function to convert the scores to the probability in the link prediction task.
But most of the edges had more than 0.9 value after going through the sigmoid function.
To deal with this problem, I tried to change the slope of the sigmoid, but I couldn’t find any parameter about it in the basic sigmoid function (Now I’m using it as tensor.sigmoid() form).
https://pytorch.org/docs/stable/generated/torch.sigmoid.html

In this case, 1) is it a reasonable approach to change the slope of the sigmoid function? 2) are there any function to change scores to the probability (0~1)?
Thank you for reading this question.

Hi @songsong0425,

If you want to change the slope of the sigmoid function, you could just multiple the input to the sigmoid function by a scalar (or you just use a nn.Parameter if you want to vary the slope given a specific input).

slope = nn.Parameter(1)
probabilities = torch.sigmoid(slope * x)

You could also enforce that the slope is strictly positive via a nn.ReLU function as a negative slope will flip your probability values.

1 Like