Logistic Regression - Sigmoid Function Plot
In this post, you will learn about the following:
The below is the Logit Function code representing association between the probability that an event will occur and independent features.
$$Logit Function = \log(\frac{P}{(1-P)}) = {w_0} + {w_1}{x_1} + {w_2}{x_2} + …. + {w_n}{x_n}$$
$$Logit Function = \log(\frac{P}{(1-P)}) = W^TX$$
$$P = \frac{1}{1 + e^-W^TX}$$
The above equation can be called as sigmoid function.
import numpy as np import matplotlib.pyplot as plt # Sigmoid function # def sigmoid(z): return 1 / (1 + np.exp(-z)) # Creating sample Z points # z = np.arange(-5, 5, 0.1) # Invoking Sigmoid function on all Z points # phi_z = sigmoid(z) # Plotting the Sigmoid function # plt.plot(z, phi_z) plt.axvline(0.0, color='k') plt.xlabel('z') plt.ylabel('$\phi(z)$') plt.yticks([0.0, 0.5, 1.0]) ax = plt.gca() ax.yaxis.grid(True) plt.tight_layout() plt.show()
Executing the above code would result in the following plot:
Fig 1: Logistic Regression – Sigmoid Function Plot
Pay attention to some of the following in above plot:
Last updated: 25th Jan, 2025 Have you ever wondered how to seamlessly integrate the vast…
Hey there! As I venture into building agentic MEAN apps with LangChain.js, I wanted to…
Software-as-a-Service (SaaS) providers have long relied on traditional chatbot solutions like AWS Lex and Google…
Retrieval-Augmented Generation (RAG) is an innovative generative AI method that combines retrieval-based search with large…
The combination of Retrieval-Augmented Generation (RAG) and powerful language models enables the development of sophisticated…
Have you ever wondered how to use OpenAI APIs to create custom chatbots? With advancements…
View Comments
nice