# How to calculate a logistic sigmoid function in Python?

Rate this post

Today, We want to share with you sigmoid function python.In this post we will show you Activation Functions in Neural Networks (relu function python), hear for A beginner’s guide to NumPy with Sigmoid, ReLu and Softmax activation functions we will give you demo and example for implement.In this post, we will learn about How To Negate A Boolean Value In Python? with an example.

## Implement sigmoid function using Numpy

The logistic sigmoid simple function defined as eq (1/(1 + e^-x)) takes an input x of any real number as well as data returns an output value in the main range of -1 and 1.

Read Also:  Python Program to Check Armstrong Number

### DEFINE A LOGISTIC SIGMOID FUNCTION

Define a fresh logistic sigmoid python function that takes input x as well as returns 1/(1 + math.exp(-x)).

Example :

```def sigmoid(x):
return 1 / (1 + math.exp(-x))

print(sigmoid(0.5))

```

RESULTS

```0.6224593312018546
```

Free Live Chat for Any Issue

Example :

```import math

def sigmoid(x):
return 1 / (1 + math.exp(-x))
```

And lasy now you can simple test it by calling:

```>>> sigmoid(0.458)
0.61253961344091512
```

REFER : It is also available in scipy : http://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.logistic.html