Diff of /Models/Network/DNN.py [000000] .. [259458]

Switch to side-by-side view

--- a
+++ b/Models/Network/DNN.py
@@ -0,0 +1,36 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+# Import useful packages
+import tensorflow as tf
+
+
+def DNN(Input, keep_prob, weights_1, biases_1, weights_2, biases_2):
+    '''
+
+    Args:
+        Input: The input EEG signals
+        keep_prob: The Keep probability of Dropout
+        weights_1: The Weights of first fully-connected layer
+        biases_1: The biases of first fully-connected layer
+        weights_2: The Weights of second fully-connected layer
+        biases_2: The biases of second fully-connected layer
+
+    Returns:
+        FC_2: Final prediction of DNN Model
+        FC_1: Extracted features from the first fully connected layer
+
+    '''
+
+    # First fully-connected layer
+    FC_1 = tf.matmul(Input, weights_1) + biases_1
+    FC_1 = tf.layers.batch_normalization(FC_1, training=True)
+    FC_1 = tf.nn.softplus(FC_1)
+    FC_1 = tf.nn.dropout(FC_1, keep_prob)
+
+    # Second fully-connected layer
+    FC_2 = tf.matmul(FC_1, weights_2) + biases_2
+    FC_2 = tf.nn.softmax(FC_2)
+
+    return FC_2, FC_1
+