title: Classification metrics can't handle a mix of multiclass and continuous-multioutput targets
body: <p>I am running a <code>BERT</code> pretrained model on a  <code>multiclass</code> dataset for text classification purposes. Since it is multiclass I cannot figure out how to generate a <code>classification report</code>. The solutions I found were <a href="https://stackoverflow.com/questions/48987959/classification-metrics-cant-handle-a-mix-of-continuous-multioutput-and-multi-la">this</a> and <a href="https://stackoverflow.com/questions/56492186/f-score-valueerror-classification-metrics-cant-handle-a-mix-of-multilabel-ind">this</a>. I understand since its a multiclass classification I have to <code>one-hot-encode</code> the <code>test_y</code> values (which I did)</p>
  <pre><code>test_y = to_categorical(np.asarray(test_y.factorize()[0]))
  </code></pre>
  <p>but when I do</p>
  <pre><code>from sklearn.metrics import classification_report
  print(classification_report(test_y, y_pred, digits=8))
  </code></pre>
  <p>I get still get this error :</p>
  <pre><code>     88     if len(y_type) &gt; 1:
       89         raise ValueError(&quot;Classification metrics can't handle a mix of {0} &quot;
  ---&gt; 90                          &quot;and {1} targets&quot;.format(type_true, type_pred))
       91 
       92     # We can't have more than one value on y_type =&gt; The set is no more needed
  
  ValueError: Classification metrics can't handle a mix of multilabel-indicator and continuous-multioutput targets
  </code></pre>
  <p>Why?</p>
  <p>And if I try to calculate <code>accuracy_score</code> I get <code>0.0</code> accuracy: (but my accuracy is around 60%)</p>
  <pre><code>from sklearn.metrics import accuracy_score
  y_pred = np.argmax(y_pred, axis=1)
  accuracy_score(test_y, y_pred)
  &gt;&gt; 0.0
  </code></pre>
  <p>Why?</p>
  <p>Details of the model is given below:</p>
  <blockquote>
  <p>train_test_split</p>
  </blockquote>
  <pre><code>train, test, train_y, test_y = train_test_split(df['text'], df['label'],test_size = 0.3)
  </code></pre>
  <blockquote>
  <p>Model:</p>
  </blockquote>
  <pre><code> def build_model(bert_layer, max_len=512):
      input_word_ids = Input(shape=(max_len,), dtype=tf.int32, name=&quot;input_word_ids&quot;)
      input_mask = Input(shape=(max_len,), dtype=tf.int32, name=&quot;input_mask&quot;)
      segment_ids = Input(shape=(max_len,), dtype=tf.int32, name=&quot;segment_ids&quot;)
  
      _, sequence_output = bert_layer([input_word_ids, input_mask, segment_ids])
      clf_output = sequence_output[:, 0, :]
      #out = Dense(1, activation='sigmoid')(clf_output)
      out = Dense(8, activation='sigmoid')(clf_output)
      
      model = Model(inputs=[input_word_ids, input_mask, segment_ids], outputs=out)
      model.compile(Adam(lr=2e-6), loss='categorical_crossentropy', metrics=['accuracy'])
      
      return model
  </code></pre>
  <blockquote>
  <p>Model.fit</p>
  </blockquote>
  <pre><code>    train_history = model.fit(train_input, train_labels, validation_split=0.2, epochs=1,batch_size=16 )
  </code></pre>
  <blockquote>
  <p>model.predict</p>
  </blockquote>
  <pre><code>y_pred = model.predict(test_input)
  </code></pre>
  <blockquote>
  <p>Shape of parameters</p>
  </blockquote>
  <pre><code>print(type(y_pred))
  print(y_pred.shape)
  &gt;&gt; &lt;class 'numpy.ndarray'&gt;
  &gt;&gt; (621,)
  
  print(type(test_y)) #before running to_categorical
  print(test_y.shape)
  &gt;&gt; &lt;class 'pandas.core.series.Series'&gt;
  &gt;&gt;(621,)
  </code></pre>