Answers.Body: <p>First of all, sigmoid does not output 0 or 1, it outputs any real number in the range between 0 and 1.</p>
  <p>Furthermore, neural networks don't usually output binary values, unless the output layer uses the step function as an activation function (which is rare).</p>
  <p>I'm not really sure if you want the neural network to be a classifier or regressor, but it sounds like you want a regressor.</p>
  <p>Regression is when you are interested in the value of the output neuron(s) itself. A simple example is if you want the network to predict the sum of two input neurons.</p>
  <p>If you want to change the network from a classifier to a regressor you should probably reduce the number of neurons in the output layer to 1, and change the activation function of that neuron from softmax to the identity function (<span class="math-container">$f(x)=x$</span>; which is the same as no activation function at all).</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-09-12T11:14:46.463Z
Answers.Text: @JessBullard: This answer is accurate. Generally for regression problems you would use a linear output at the final layer, and mean squared error for the loss function. You would still use non-linear in the hidden layers. Example in Keras: https://machinelearningmastery.com/regression-tutorial-keras-deep-learning-library-python/
Answers.UserDisplayName: Neil Slater
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-09-13T01:12:35.913Z
Answers.Text: @NeilSlater I looked at the code presented in the link. That appears to be similar to what I am looking for. How would I get it to output it's prediction given an input? I've seen many questions about this in the comments of his post but no solution has worked.
Answers.UserDisplayName: Jess Bullard
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-09-13T06:14:57.547Z
Answers.Text: @JessBullard: that should just be `model.predict` See the Keras documentation here: https://keras.io/models/model/
Answers.UserDisplayName: Neil Slater
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-09-13T13:01:56.170Z
Answers.Text: @NeilSlater I do that but then it expects shape2 but was given shape1. All the solutions I've found have not worked.
Answers.UserDisplayName: Jess Bullard
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-09-13T13:11:41.080Z
Answers.Text: @JessBullard: That is a mistake when using it. Probably you are passing in a single example and it expects an array of examples. If you cannot figure that out, ask a question on Data Science or Stack Overflow showing the relevant part of your code and the error message you get. Note this has probably already been answered multiple times on both sites, so try searching your goal and error message there first.
Answers.UserDisplayName: Neil Slater
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-09-10T22:01:44.643Z
Answers.LastActivityDate: 2021-12-20T23:55:45.983Z
Answers.LastEditDate: 2021-12-20T23:55:45.983Z
Answers.UserDisplayName: Mr. Eivind
Body: <p>I would like to create a neural network, which, given the training data (e.g. 58, 2) outputs a non-binary number (e.g 100). Perhaps I am not searching for the correct thing, but all the examples I have found have shown classifiers using a sigmoid function (range of 1 to 0). I am looking for something that would output nonbinary numbers.</p>
  
Tags: <neural-networks><activation-functions><regression><network-design>
Title: How would I go about creating a neural network that outputs a non-binary number?
UserDisplayName: Jess Bullard
ThreadText: # How would I go about creating a neural network that outputs a non-binary number?
  
  (Asked by: username_0 on 2018-09-10)
  
  I would like to create a neural network, which, given the training data (e.g. 58, 2) outputs a non-binary number (e.g 100). Perhaps I am not searching for the correct thing, but all the examples I have found have shown classifiers using a sigmoid function (range of 1 to 0). I am looking for something that would output nonbinary numbers.
  
  **Tags:** neural-networks, activation-functions, regression, network-design
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2018-09-10. Score: 3 | Accepted answer
  
  First of all, sigmoid does not output 0 or 1, it outputs any real number in the range between 0 and 1.
  
  Furthermore, neural networks don't usually output binary values, unless the output layer uses the step function as an activation function (which is rare).
  
  I'm not really sure if you want the neural network to be a classifier or regressor, but it sounds like you want a regressor.
  
  Regression is when you are interested in the value of the output neuron(s) itself. A simple example is if you want the network to predict the sum of two input neurons.
  
  If you want to change the network from a classifier to a regressor you should probably reduce the number of neurons in the output layer to 1, and change the activation function of that neuron from softmax to the identity function ($f(x)=x$; which is the same as no activation function at all).
  
  > **Comments:**
  > **username_2**: @JessBullard: This answer is accurate. Generally for regression problems you would use a linear output at the final layer, and mean squared error for the loss function. You would still use non-linear in the hidden layers. Example in Keras: https://machinelearningmastery.com/regression-tutorial-keras-deep-learning-library-python/  
  > **username_0**: @NeilSlater I looked at the code presented in the link. That appears to be similar to what I am looking for. How would I get it to output it's prediction given an input? I've seen many questions about this in the comments of his post but no solution has worked.  
  > **username_2**: @JessBullard: that should just be `model.predict` See the Keras documentation here: https://keras.io/models/model/  
  > **username_0**: @NeilSlater I do that but then it expects shape2 but was given shape1. All the solutions I've found have not worked.  
  > **username_2**: @JessBullard: That is a mistake when using it. Probably you are passing in a single example and it expects an array of examples. If you cannot figure that out, ask a question on Data Science or Stack Overflow showing the relevant part of your code and the error message you get. Note this has probably already been answered multiple times on both sites, so try searching your goal and error message there first.  
  
  ---
  
  