title: Keras fit classifier with 2 and more output classes a metric label must be specified
body: <p>while trying to fit a classifier (using the KerasWrapper from sklearn, i.e. <code>from keras.wrappers.scikit_learn import KerasClassifier</code>), I get the following error:</p>
  
  <pre><code>Traceback (most recent call last):
    File "extArgExtraction.py", line 915, in &lt;module&gt;
  a, p, r, f = evaluatePositionOnlyNeural(matrix, numIterations)
    File "extArgExtraction.py", line 367, in evaluatePositionOnlyNeural
  classifier.fit(X, Y, class_weight=class_weights)
    File "/usr/local/lib/python3.5/dist-packages/keras/wrappers/scikit_learn.py", line 210, in fit
  return super(KerasClassifier, self).fit(x, y, **kwargs)
    File "/usr/local/lib/python3.5/dist-packages/keras/wrappers/scikit_learn.py", line 141, in fit
  self.model = self.build_fn(**self.filter_sk_params(self.build_fn))
    File "extArgExtraction.py", line 493, in create_baseline_model
  model.compile(loss='categorical_crossentropy', optimizer='adam', metrics=['categorical_accuracy', keras_metrics.precision(), keras_metrics.recall(), keras_metrics.f1_score()]) # perhaps this should not be binary (but categorical instead)
    File "/usr/local/lib/python3.5/dist-packages/keras/engine/training.py", line 440, in compile
  handle_metrics(output_metrics)
    File "/usr/local/lib/python3.5/dist-packages/keras/engine/training.py", line 409, in handle_metrics
  mask=masks[i])
    File "/usr/local/lib/python3.5/dist-packages/keras/engine/training_utils.py", line 403, in weighted
  score_array = fn(y_true, y_pred)
    File "/usr/local/lib/python3.5/dist-packages/keras_metrics/metrics.py", line 213, in __call__
  tp = self.tp(y_true, y_pred)
    File "/usr/local/lib/python3.5/dist-packages/keras_metrics/metrics.py", line 70, in __call__
  y_true, y_pred = self.cast(y_true, y_pred)
    File "/usr/local/lib/python3.5/dist-packages/keras_metrics/metrics.py", line 24, in cast
  return self.cast_strategy(y_true, y_pred, dtype=dtype)
    File "/usr/local/lib/python3.5/dist-packages/keras_metrics/metrics.py", line 46, in _categorical
  raise ValueError("With 2 and more output classes a "
  
  ValueError: With 2 and more output classes a metric label must be specified
  </code></pre>
  
  <p>Relevant piece of code:</p>
  
  <pre><code>df = pandas.DataFrame(numpy.array(nmatrix), columns=None)
  ds = df.values
  X = ds[:,0:numpy.shape(df)[1]-1].astype(float)
  Y = to_categorical(numpy.array(labels))#numpy.reshape(numpy.array(labels), len(labels), 1))
  
  classifier.fit(X, Y)#, class_weight=class_weights)
  </code></pre>
  
  <p>I cannot find this error anywhere (on google). Anyone any ideas on how to specify a metric label?</p>