brain.js icon indicating copy to clipboard operation
brain.js copied to clipboard

Feature Request: Add Mish activation

Open digantamisra98 opened this issue 4 years ago • 10 comments

Mish is a new novel activation function proposed in this paper. It has shown promising results so far and has been adopted in several packages including:

All benchmarks, analysis and links to official package implementations can be found in this repository

It would be nice to have Mish as an option within the activation function group.

This is the comparison of Mish with other conventional activation functions in a SEResNet-50 for CIFAR-10:
se50_1

digantamisra98 avatar Nov 25 '19 07:11 digantamisra98

function mish(x) { return x * (Math.exp(Math.log(1 + Math.exp(x))) - Math.exp(-Math.log(1 + Math.exp(x))))/(Math.exp(Math.log(1 + Math.exp(x))) + Math.exp(-Math.log(1 + Math.exp(x)))); }

function derivativeOfMish(y) { let omega = Math.exp(3 * y)+4 * Math.exp(2 * y) + (6+4 * y) * Math.exp(y) + 4 * (1 + y); let delta = 1 + Math.pow((Math.exp(y) + 1), 2); return Math.exp(y) * omega / Math.pow(delta, 2); }

extremety1989 avatar Jan 08 '20 13:01 extremety1989

Can you please add mish function,that i provided, i already tested it on my custom neural network and it works great,better than sigmoid and tanh ! on XOR

extremety1989 avatar Jan 10 '20 15:01 extremety1989

That sounds great. Would love to see as contributor though.

mubaidr avatar Jan 10 '20 15:01 mubaidr

Keep in mind we have the GPU implementations as well.

robertleeplummerjr avatar Jan 10 '20 16:01 robertleeplummerjr

@mubaidr how can i apply this function as contributor?

extremety1989 avatar Jan 10 '20 18:01 extremety1989

@extremety1989 are you planning to submit a PR?

digantamisra98 avatar Jan 20 '20 05:01 digantamisra98

@digantamisra98 no, sometimes it returns NaN when learning rate is 0.1, i do not know what is the probleme,maybe javascript

extremety1989 avatar Jan 22 '20 14:01 extremety1989

@extremely1989 Mish has a Softplus operator which needs proper threshold to fix that NaN issue you might be facing.

digantamisra98 avatar Jan 22 '20 23:01 digantamisra98

@digantamisra98 my threshold is 0.5, i how much should i turn ?

extremety1989 avatar Jan 26 '20 16:01 extremety1989

@extremety1989 the Softplus operator thresholds that Tensorflow use is in the range of [0,20]

digantamisra98 avatar Jan 27 '20 08:01 digantamisra98