Questions tagged [sigmoid]

A sigmoid function is a mathematical function having an "S" shape (sigmoid curve). Often, sigmoid function refers to the special case of the logistic function defined by the formula S ( t ) = 1 / (1 + e^-t)

Sigmoid function (Wikipedia)

256 questions
6
votes
1 answer

Fit and compare multiple sigmoid curves in R

I would like to fit multiple curves at once, and compare them statistically, in terms of their 3 estimated parameters – asymptote, slope and x0. Here is an idealized image of the data to be modeled: Most searchable pages turn up methods to fit a…
Matt74
  • 729
  • 4
  • 8
5
votes
1 answer

finding a point on a sigmoidal curve in r

Here is a data set: df <- data.frame('y' = c(81,67,54,49,41,25), 'x' =c(-50,-30,-10,10,30,50)) So far, I know how to fit a sigmoidal curve and display it on screen: plot(df$y ~ df$x) fit <- nls(y ~ SSlogis(x, Asym, xmid, scal), data =…
B C
  • 318
  • 3
  • 16
4
votes
3 answers

Sigmoid Function in Numpy

For fast computations, I have to implement my sigmoid function in Numpy this is the code below def sigmoid(Z): """ Implements the sigmoid activation in bumpy Arguments: Z -- numpy array of any shape Returns: A -- output…
TheHedge
  • 107
  • 1
  • 1
  • 9
4
votes
2 answers

torch.softmax and torch.sigmoid are not equivalent in the binary case

Given: x_batch = torch.tensor([[-0.3, -0.7], [0.3, 0.7], [1.1, -0.7], [-1.1, 0.7]]) and then applying torch.sigmoid(x_batch): tensor([[0.4256, 0.3318], [0.5744, 0.6682], [0.7503, 0.3318], [0.2497, 0.6682]]) gives a…
CutePoison
  • 4,679
  • 5
  • 28
  • 63
4
votes
3 answers

What are the benefits of using a sigmoid function?

I am dipping my toe into neural networks and starting with some basic perceptrons. In one video, this guy is explaining how to make a machine that can 'learn' how to distinguish two arrays. He explains the training process, but just shoves all of…
Darrow Hartman
  • 4,142
  • 2
  • 17
  • 36
4
votes
1 answer

Fit sigmoid curve in python

Thanks ahead! I am trying to fit a sigmoid curve over some data, below is my code import numpy as np import matplotlib.pyplot as plt from scipy.optimize import curve_fit ====== some code in between ======= plt.scatter(drag[0].w,drag[0].s, s = 10,…
4
votes
2 answers

How to apply sigmoid function for each outputs in Keras?

This is part of my codes. model = Sequential() model.add(Dense(3, input_shape=(4,), activation='softmax')) model.compile(Adam(lr=0.1), loss='categorical_crossentropy', metrics=['accuracy']) with this code, it will apply softmax…
Reo Tamai
  • 43
  • 1
  • 3
4
votes
1 answer

Does the last layer of a classifier neural network use both sigmoid and softmax?

Hidden layers of a classifier network use sigmoid or another activation function to introduce non-linearity and normalize the data, but does the last layer use sigmoid in conjunction with softmax? I have a feeling it doesn't matter and the network…
Evan Weissburg
  • 1,564
  • 2
  • 17
  • 38
4
votes
2 answers

Why multiply the error by the derivative of the sigmoid in neural networks?

Here is the code: import numpy as np # sigmoid function def nonlin(x,deriv=False): if(deriv==True): return x*(1-x) return 1/(1+np.exp(-x)) # input dataset X = np.array([ [0,0,1], [0,1,1], [1,0,1], …
Meme Stream
  • 171
  • 2
  • 11
4
votes
6 answers

Compute e^x for float values in System Verilog?

I am building a neural network running on an FPGA, and the last piece of the puzzle is running a sigmoid function in hardware. This is either: 1/(1 + e^-x) or (atan(x) + 1) / 2 Unfortunately, x here is a float value (a real value in…
rohan32
  • 500
  • 1
  • 7
  • 18
3
votes
0 answers

CLIP for multi-label classification

I am using CLIP to determine the similarity between words and images. For now I am using this repo and the following code and for classification it gives great results. I would need it for multi label classification in which I would need to use…
3
votes
1 answer

Sigmoid curve detection

I have tabular data-set representing curves, each curve is represented by 42 values(data points), the goal is to filter out curves that do not follow Sigmoid function. Technique applied Sigmoid Curve Fitting Calculate goodness of curve Curve…
alex3465
  • 409
  • 4
  • 18
3
votes
2 answers

How to change PyTorch sigmoid function to be steeper

My model works when I use torch.sigmoid. I tried to make the sigmoid steeper by creating a new sigmoid function: def sigmoid(x): return 1 / (1 + torch.exp(-1e5*x)) But for some reason the gradient doesn't flow through it (I get NaN). Is there a…
user12853381
3
votes
3 answers

Why is the decoder in an autoencoder uses a sigmoid on the last layer?

I am looking at this working variational auto encoder. The main class class VAE(nn.Module): def __init__(self): super(VAE, self).__init__() self.fc1 = nn.Linear(784, 400) self.fc21 = nn.Linear(400, 20) self.fc22…
Gulzar
  • 23,452
  • 27
  • 113
  • 201
3
votes
2 answers

Activation functions: Softmax vs Sigmoid

I've been trying to build an image classifier with CNN. There are 2300 images in my dataset and two categories: men and women. Here's the model I used: early_stopping = EarlyStopping(min_delta = 0.001, patience = 30, restore_best_weights =…
1
2
3
17 18