title: Multi-Output Classification with Keras
body: <p>I am using keras to build a multi-output classification model. My dataset is such as </p>
  
  <blockquote>
    <p>[x1,x2,x3,x4,y1,y2,y3]</p>
  </blockquote>
  
  <p>x1,x2,x3 are the features, and y1,y2,y3 are the labels, the y1,y2,y3 are multi-classes.</p>
  
  <p>And I already built a model (I ingore some hidden layers):</p>
  
  <pre><code>def baseline_model(input_dim=23,output_dim=3):
      model_in = Input(shape=(input_dim,))
      model = Dense(input_dim*5,kernel_initializer='uniform',input_dim=input_dim)(model_in)
      model = Activation(activation='relu')(model)
      model = Dropout(0.5)(model)
  
      ...................
  
      model = Dense(output_dim,kernel_initializer='uniform')(model)
      model = Activation(activation='sigmoid')(model)
  
      model = Model(model_in,model)
      model.compile(optimizer='adam',loss='binary_crossentropy', metrics=['accuracy'])
      return model
  </code></pre>
  
  <p>And then I try to use the method of keras to make it support classification:</p>
  
  <pre><code>estimator = KerasClassifier(build_fn=baseline_model)
  estimator.fit()
  estimator.predict(df[0:10])
  </code></pre>
  
  <p>But I found that the result is not multi-output, only one dimension is output. </p>
  
  <blockquote>
    <p>[0,0,0,0,0,0,0,0,0,0]</p>
  </blockquote>
  
  <p>So for the multi-output classification problem, we can not use KerasClassifier function to learn it?</p>