WalzoneInterview Prep
📞 Interviewing soon? Practice with a realistic AI mock phone interview — it calls you, then scores you. First 15 min FREE →

Data Science · Intermediate · question 32 of 100

What is the purpose of using activation functions in neural networks, and can you name a few common activation functions?

📕 Buy this interview preparation book: 100 Data Science questions & answers — PDF + EPUB for $5

Activation functions play an important role in artificial neural networks, as they introduce non-linearity to the network’s output, allowing the model to approximate non-linear functions. The activation function transforms the weighted sum of input values and biases of each neuron into the output value. Without an activation function, a neural network would simply be a linear regression model, which is not effective for many real-world problems that involve non-linear patterns.

There are several activation functions commonly used in neural networks, some of them are: - **Sigmoid function**: The sigmoid function is a widely used activation function that turns any input into a value between zero and one. It is expressed as:


$$sigmoid(x) = \frac{1}{1+e^{-x}}$$

- **ReLU (Rectified Linear Unit)**: The ReLU activation function is defined as the maximum between zero and the input value. It is a simple and efficient activation function that is commonly used in deep learning models. The ReLU function can be expressed as:


ReLU(x) = max(0, x)

- **Tanh (Hyperbolic Tangent)**: The hyperbolic tangent function maps the input values to a range between -1 and 1. It is a popular activation function used in feedforward neural network models. The Tanh function can be expressed as:


$$tanh(x) = \frac{(e^{x} - e^{-x})}{(e^{x} + e^{-x})}$$

- **Softmax**: The softmax function is commonly used as an activation function for the output layer of a neural network for multiclass classification problems. It maps the inputs to a probability distribution over the classes. The softmax function can be expressed as:


$$softmax(x_i) = \frac{e^{x_i}}{\sum_{j=1}^{K} e^{x_j}}$$

Where, K is the number of classes.

Overall, activation functions are an essential tool for neural networks to model complex non-linear relationships between input and output spaces.

Reading is step one. Saying it out loud is the interview. Our AI interviewer calls your phone and runs a realistic Data Science interview — then scores it.
📞 Practice Data Science — free 15 min
📕 Buy this interview preparation book: 100 Data Science questions & answers — PDF + EPUB for $5

All 100 Data Science questions · All topics