source: anac2020/BlingBling/src/main/java/geniusweb/blingbling/Ranknet/SigmoidActivationFunction.java@ 14

Last change on this file since 14 was 1, checked in by wouter, 4 years ago

#1910 added anac2020 parties

File size: 637 bytes
Line 
1package geniusweb.blingbling.Ranknet;
2
3import org.nd4j.linalg.api.ndarray.INDArray;
4import org.nd4j.linalg.factory.Nd4j;
5import org.nd4j.linalg.ops.transforms.Transforms;
6
7public class SigmoidActivationFunction implements IActivationFunction {
8 public static final IActivationFunction INSTANCE = new SigmoidActivationFunction();
9
10 public INDArray output(INDArray input) {
11 return Transforms.sigmoid(input);
12 }
13
14 public INDArray derivative(INDArray input) {
15 INDArray sigmoid = Transforms.sigmoid(input);
16 INDArray ones = Nd4j.ones(sigmoid.shape());
17
18 return sigmoid.mul(ones.sub(sigmoid));
19 }
20}
Note: See TracBrowser for help on using the repository browser.