title: How to preprocess a dataset with multiple input variables for integration with Tensorflow for binary classification?
body: <p>I am trying to setup a minimum viable neural network to train for a binary classification task. I am importing a CSV file with seven total columns, the first column is the true label, 1 or -1. I have divided the dataset into a training set and test set. Additionally, I have been able to import the dataset into python, and normalize the six variables to numbers between zero and one.</p>
  
  <p>I have been spending the past few hours developing ad hoc, layers for a neural network. I have been able to get the network to feedforward, and to make binary predictions. However, I am totally at a loss for how to train the model because I cannot figure out how to update the weights. Generally, I am familiar with back-propagation, SGD, derivates, ADAM, and the perceptron learning rule. The problem is I have been unable to figure out how to implement any of these methods, so my program learns.</p>
  
  <p>In short, my goal is to update the weights of the neural network if the predict label and true label are not the same, so the network can learn.</p>
  
  <p>I have tried using Keras because it is a high level API. <a href="https://www.tensorflow.org/tutorials/keras/basic_classification#build_the_model" rel="nofollow noreferrer">https://www.tensorflow.org/tutorials/keras/basic_classification#build_the_model</a> While keras is good for getting started, it is very difficult to use Keras or Tensorflow on the datasets I generated myself. I am having trouble reformatting a neural network for the MNIST dataset to the needs of my present task <a href="https://medium.com/@brian.s.haney44/computer-vision-b39256f13fa4" rel="nofollow noreferrer">https://medium.com/@brian.s.haney44/computer-vision-b39256f13fa4</a>. I was hoping to complete the task with the Python standard library. Further, I have looked into and researched matrix multiplication vs. linear models for feedforward propagation, as well as derivative calculators and the perceptron learning rule for for weight updates. I created a Github <a href="https://github.com/Bhaney44/Deep-Neural-Network" rel="nofollow noreferrer">https://github.com/Bhaney44/Deep-Neural-Network</a> repo for the project with a sample dataset for illustrative purposes.</p>
  
  <p>'''</p>
  
  <pre><code>    #Input Array
      input_array = (true_label, var_1, var_2, var_3)
  
      #Input layer with three nodes and a normalization function
      def input_layer():
          x_1 = (input_array[1])/float(100)
          x_2 = (input_array[2])/float(100)
          x_3 = (input_array[2])/float(100)
  
          #Hidden layer
          def hidden_layer():
              w_0 = 0.1
              w_1 = 0.1
              w_2 = 0.1
              w_3 = 0.1
              x_4 = (x_1 * w_0)+(x_2 * w_1)
              x_5 = (x_2 * w_2)+(x_3 * w_3)
  
              #Output layer
              def output_layer():
                  w_4 = 0.1
                  w_5 = 0.1
                  x_6 = (x_4 * w_4)+(x_5 * w_5)
  
                  #Activation function
                  def activation():
                      #True label
                      x_0 = input_array[0]
                      #decision function
                      if x_6 &gt; 0.5:
                          y = 1
                      else:
                          y = -1
  
                      #activation function
                      if y is x_0:
                          #Here the network predicted right
                          print('correct')
                      else:
                          #Here I want to adjust the weigh parameters
                          #However, I am not sure where to start
                          #Ideas include
                              #calculate loss function
                              #change weights structure
                              #use matrices instead of coefficients
                          print('update weights')
  
                  activation()
              output_layer()
          hidden_layer()
      input_layer()  
  </code></pre>
  
  <p>'''</p>
  
  <p>My expectation is to find a way to update the weights, so the network can learn from training data and be applied to new data. The results are as I expect because I put a print function as a placeholder for the weight update algorithm. I am just not sure how to link functions together or to change numbers within the program automatically. I would sincerely appreciate any help, advice, suggestions, or criticisms.</p>
  
  <p>With thanks,</p>
  
  <p>Brian</p>