I am trying to make a neural network which takes in 0 and 1 as it's input and should give me output ranging from [-20,-1].I am using three layers with sigmoid as the activation function .How should I design my output layer?Any sort of code snippet from your side will be helpful .I am using tensorflow.Please help me out with the same

  • $\begingroup$ You can use $tanh$ function as the activation for the output and then the result would be $y = 9.5 \cdot tanh(x) - 10.5$. That way when $tanh$ gives output $1$ , $y$ would be $-1$ and when $tanh$ gives $-1$ output would be $-20$ and anything in $[-1, 1]$ would be in $[-20, -1]$. $\endgroup$ – Brale Nov 16 '19 at 11:36
  • $\begingroup$ Thanks.:)..I just tried adding it but still my network is not learning at all. $\endgroup$ – Aggraj Gupta Nov 16 '19 at 12:00
  • $\begingroup$ Try using MinMaxScaler to normalize target values. And then you can use the inverse transform of the output after training. $\endgroup$ – serali Nov 16 '19 at 13:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.