Skip to content

Commit 994463b

Browse files
committed
Making sure ActivationReLU params work properly
1 parent e82ec66 commit 994463b

File tree

2 files changed

+44
-1
lines changed

2 files changed

+44
-1
lines changed

src/main/java/org/encog/engine/network/activation/ActivationReLU.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public class ActivationReLU implements ActivationFunction {
4242
/**
4343
* The ramp low parameter.
4444
*/
45-
public static final int PARAM_RELU_LOW = 0;
45+
public static final int PARAM_RELU_LOW = 1;
4646

4747
/**
4848
* The serial ID.
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
/*
2+
* Encog(tm) Core v3.4 - Java Version
3+
* http://www.heatonresearch.com/encog/
4+
* https://github.com/encog/encog-java-core
5+
6+
* Copyright 2008-2017 Heaton Research, Inc.
7+
*
8+
* Licensed under the Apache License, Version 2.0 (the "License");
9+
* you may not use this file except in compliance with the License.
10+
* You may obtain a copy of the License at
11+
*
12+
* http://www.apache.org/licenses/LICENSE-2.0
13+
*
14+
* Unless required by applicable law or agreed to in writing, software
15+
* distributed under the License is distributed on an "AS IS" BASIS,
16+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17+
* See the License for the specific language governing permissions and
18+
* limitations under the License.
19+
*
20+
* For more information on Heaton Research copyrights, licenses
21+
* and trademarks visit:
22+
* http://www.heatonresearch.com/copyright
23+
*/
24+
package org.encog.neural.activation;
25+
26+
import junit.framework.TestCase;
27+
import org.encog.Encog;
28+
import org.encog.engine.network.activation.ActivationReLU;
29+
import org.junit.Assert;
30+
31+
public class TestActivationReLU extends TestCase {
32+
public void testActivationWithParams() {
33+
double v = -0.066669475510992;
34+
double[] vx = {v};
35+
36+
new ActivationReLU().activationFunction(vx, 0, 1);
37+
Assert.assertEquals(0.0, vx[0], Encog.DEFAULT_DOUBLE_EQUAL);
38+
39+
vx[0] = v;
40+
new ActivationReLU(-0.1, 0.0).activationFunction(vx, 0, 1);
41+
Assert.assertEquals(v, vx[0], Encog.DEFAULT_DOUBLE_EQUAL);
42+
}
43+
}

0 commit comments

Comments
 (0)