title: How to get a binary bipolar activation function for output as +1 and -1 in keras?
body: <p>I want to have the y_pred output as either +1 or -1 only. It should not have the intermediate real values and not even zero.</p>
  
  <pre><code>classifier = Sequential()
  
  #adding layers
  # Adding the input layer and the first hidden l`enter code here`ayer
  classifier.add(Dense(output_dim = 6, init = 'uniform', activation ='relu', input_shape = (22,)))
  # Adding the second hidden layer classifier.add(Dense(output_dim = 6, init = 'uniform', activation = 'relu'))
  # Adding the output layer
  classifier.add(Dense(output_dim = 1, init = 'uniform', activation = 'tanh'))
  
  # Compiling Neural Network
  classifier.compile(optimizer = 'adam', loss = 'binary_crossentropy', metrics = ['accuracy'])
  
  # Fitting our model 
  classifier.fit(x_train, y_train, batch_size = 10, epochs = 100)
  
  # Predicting the Test set results
  y_pred = classifier.predict(x_test)
  </code></pre>
  
  <p>The output values of y_pred are in the range of [-1,1] but I expected values only to be either of 1 or -1.</p>