Get same value for predictions by a Neural network implemented using python
<p>I want to predict whether a given passenger is survived or not, in the titanic disaster. I give 0 to the unsurvived ones and 1 to the survived ones. I used python scikit learn library and implemented the following neural network for classification. When predicting, I get only 0 for all the passengers. Can anyone help me to solve this problem. </p>

<pre><code>from sklearn.neural_network import MLPClassifier

&gt;&gt;&gt; clf = MLPClassifier(solver='lbgfs', alpha=1e-5,
...                     hidden_layer_sizes=(5, 2), random_state=1)
...
&gt;&gt;&gt; clf.fit(train_data)                         
MLPClassifier(activation='relu', alpha=1e-05, batch_size='auto',
       beta_1=0.9, beta_2=0.999, early_stopping=False,
       epsilon=1e-08, hidden_layer_sizes=(5, 2), learning_rate='constant',
       learning_rate_init=0.001, max_iter=200, momentum=0.9,
       nesterovs_momentum=True, power_t=0.5, random_state=1, shuffle=True,
       solver='lbgfs', tol=0.0001, validation_fraction=0.1, verbose=False,
       warm_start=False)
</code></pre>

<p>This type of problem is typically observed when data is not normalized/ standardized (at least I can not see that in your code). Neural net techniques are very susceptible of scale difference between different feature so standardization of data [mean =0 std =1] for all columns is a good practice.  </p>

python machine-learning scikit-learn neural-network prediction