-
Notifications
You must be signed in to change notification settings - Fork 244
Added tanh activation and a way to switch between different functions #56
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
When testing with the xor..... it is a little sensitive to the learning rate...... |
lib/nn.js
Outdated
|
||
setDActivationFunction(dFun = dsigmoid) { | ||
this.d_activation_function = dFun; | ||
setActivationFunction(Fun = 'sigmoid') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would you mind using func
instead of Fun
?
lib/nn.js
Outdated
return Math.tanh(x); | ||
} | ||
function dtanh(x) { | ||
return 1-(tanh(x)*tanh(x)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since the output of a node has already been passed through tanh()
I believe this would be (1-y*y)
? (The convention I'm using to note this is y
instead of x
. Am I mistaken about this?
lib/nn.js
Outdated
} | ||
|
||
function tanh(x) { | ||
return Math.tanh(x); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would you mind conforming to the 2 space indentation?
Made changes and fixed a confilict |
this seems to be covered on PR #62... |
Yes indeed, apologies @schrummy14 but I just couldn't resist the object-oriented solution. |
That is fine. It will allow for a cleaner solution. |
Also removed function so user does not have to choose both the correct activation function with the correct derivative of the activation function