diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index c932344..c8d666d 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -4,9 +4,8 @@
-
-
-
+
+
@@ -98,7 +97,14 @@
1653168727186
-
+
+ 1653176561735
+
+
+
+ 1653176561735
+
+
@@ -115,7 +121,8 @@
-
+
+
diff --git a/src/main/java/ActivationFunctions.java b/src/main/java/ActivationFunctions.java
index b073eb0..ae5e7c8 100644
--- a/src/main/java/ActivationFunctions.java
+++ b/src/main/java/ActivationFunctions.java
@@ -36,4 +36,20 @@ public class ActivationFunctions {
private static double sigma(double value) {
return 1 / (1 + Math.exp(-value));
}
+
+ public static SimpleMatrix ReLu(SimpleMatrix A) {
+ SimpleMatrix B = new SimpleMatrix(A);
+ for (int i = 0; i < A.getNumElements(); i++) {
+ B.set(i, Math.max(0, A.get(i)));
+ }
+ return B;
+ }
+
+ public static SimpleMatrix ReLuPrime(SimpleMatrix A) {
+ SimpleMatrix B = new SimpleMatrix(A);
+ for (int i = 0; i < A.getNumElements(); i++) {
+ B.set(i, A.get(i) < 0 ? 0 : 1);
+ }
+ return B;
+ }
}