Skip to content

Commit f5fb748

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

File tree

2 files changed

+43
-1
lines changed

2 files changed

+43
-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: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
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.engine.network.activation;
25+
26+
import junit.framework.TestCase;
27+
import org.encog.Encog;
28+
import org.junit.Assert;
29+
30+
public class TestActivationReLU extends TestCase {
31+
public void testActivationWithParams() {
32+
double v = -0.066669475510992;
33+
double[] vx = {v};
34+
35+
new ActivationReLU().activationFunction(vx, 0, 1);
36+
Assert.assertEquals(0.0, vx[0], Encog.DEFAULT_DOUBLE_EQUAL);
37+
38+
vx[0] = v;
39+
new ActivationReLU(-0.1, 0.0).activationFunction(vx, 0, 1);
40+
Assert.assertEquals(v, vx[0], Encog.DEFAULT_DOUBLE_EQUAL);
41+
}
42+
}

0 commit comments

Comments
 (0)