title: ValueError: Classification metrics can't handle a mix of multiclass and multilabel-indicator targets
body: <p>I have Multi class labeled text classification problem with 2000 different labels. Doing classification using LSTM with Glove Embedding.</p>
  <ol>
  <li>Label Encoder of target variable</li>
  <li>LSTM layer with Embedd Layer</li>
  <li>Error metric is F2 score</li>
  </ol>
  <h3>LabelEncoded target variable:</h3>
  <pre><code>le = LabelEncoder()  
  le.fit(y)
  train_y = le.transform(y_train)
  test_y = le.transform(y_test)
  </code></pre>
  <h3>LSTM network is like below with Glove Embeddings</h3>
  <pre><code>np.random.seed(seed)
  K.clear_session()
  model = Sequential()
  model.add(Embedding(max_features, embed_dim, input_length = X_train.shape[1],
           weights=[embedding_matrix]))#,trainable=False
  model.add(LSTM(100, dropout=0.2, recurrent_dropout=0.2))
  model.add(Dense(num_classes, activation='softmax'))
  model.compile(optimizer='rmsprop', loss='sparse_categorical_crossentropy')
  print(model.summary())
  </code></pre>
  <h4>My error metric is F1 score. I build below function for Error metric</h4>
  <pre><code>class Metrics(Callback):
      def on_train_begin(self, logs={}):
          self.val_f1s = []
          self.val_recalls = []
          self.val_precisions = []
   
      def on_epoch_end(self, epoch, logs={}):
          val_predict = (np.asarray(self.model.predict(self.validation_data[0]))).round()
          val_targ = self.validation_data[1]
          _val_f1 = f1_score(val_targ, val_predict)
          _val_recall = recall_score(val_targ, val_predict)
          _val_precision = precision_score(val_targ, val_predict)
          self.val_f1s.append(_val_f1)
          self.val_recalls.append(_val_recall)
          self.val_precisions.append(_val_precision)
          print(&quot;— val_f1: %f — val_precision: %f — val_recall %f&quot; % (_val_f1, _val_precision, _val_recall))
          return
   
  metrics = Metrics()
  </code></pre>
  <p>##Model fit is</p>
  <pre><code>model.fit(X_train, train_y, validation_data=(X_test, test_y),epochs=10, batch_size=64, callbacks=[metrics])
  </code></pre>
  <p>Getting below error after 1st epoch:</p>
  <pre><code>ValueError: Classification metrics can't handle a mix of multiclass and continuous-multioutput targets
  </code></pre>
  <p>Where is the mistake in my code?</p>