Skip to content
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

How do i change ocropus tanh activation function to ReLU #258

Open
gotwinn opened this issue Nov 3, 2017 · 3 comments
Open

How do i change ocropus tanh activation function to ReLU #258

gotwinn opened this issue Nov 3, 2017 · 3 comments

Comments

@gotwinn
Copy link

gotwinn commented Nov 3, 2017

Currently researching on which activation function affects ocropus models accuracy

@gotwinn
Copy link
Author

gotwinn commented Nov 5, 2017

So am i correct to say that ocropus uses 2 activation functions, sigmoid and tanh ?

The next question is if i want to change tanh to ReLU how should i go about in doing it ?

@gotwinn gotwinn changed the title What activation function does ocropus used ? How do i change ocropus tanh activation function to ReLU Nov 6, 2017
@mittagessen
Copy link

mittagessen commented Dec 24, 2017

An lstm cell requires the sigmoid (or rather any differentiable function with an image [0, 1]) for gate activation, the other activation is used for input to hidden state and output, i.e. an LSTM cell uses different activation functions for different parts of the cell.

To change the tanh activations you'll have to switch gfunc/gprime and hfunc/hprime in ocrolib/lstm.py to ReLu and its derivative respectively which should be f'(x) = 1: x>0 if I'm not entirely mistaken.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants