prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  Textual information for labels?
  I seem unable to use text for labels, whilst using to_categorical
  
  ```
  Using Theano backend.
  Traceback (most recent call last):
    File "playground.py", line 88, in <module>
      train_model_and_test(number_of_epochs, number_of_classes, train_data, train_label, augmented_data_generator)
    File "playground.py", line 62, in train_model_and_test
      train_label = np_utils.to_categorical(train_label, number_of_classes)
    File "/usr/local/lib/python2.7/dist-packages/keras/utils/np_utils.py", line 12, in to_categorical
      y = np.asarray(y, dtype='int32')
    File "/usr/lib/python2.7/dist-packages/numpy/core/numeric.py", line 460, in asarray
      return array(a, dtype, copy=False, order=order)
  ValueError: invalid literal for int() with base 10: 'yellow'
  ```
  
  
  </issue>
  <code>
  [start of keras/utils/np_utils.py]
  1 from __future__ import absolute_import
  2 import numpy as np
  3 import scipy as sp
  4 from six.moves import range
  5 from six.moves import zip
  6 
  7 
  8 def to_categorical(y, nb_classes=None):
  9     '''Convert class vector (integers from 0 to nb_classes)
  10     to binary class matrix, for use with categorical_crossentropy.
  11     '''
  12     y = np.asarray(y, dtype='int32')
  13     if not nb_classes:
  14         nb_classes = np.max(y)+1
  15     Y = np.zeros((len(y), nb_classes))
  16     for i in range(len(y)):
  17         Y[i, y[i]] = 1.
  18     return Y
  19 
  20 
  21 def normalize(a, axis=-1, order=2):
  22     l2 = np.atleast_1d(np.linalg.norm(a, order, axis))
  23     l2[l2 == 0] = 1
  24     return a / np.expand_dims(l2, axis)
  25 
  26 
  27 def binary_logloss(p, y):
  28     epsilon = 1e-15
  29     p = sp.maximum(epsilon, p)
  30     p = sp.minimum(1-epsilon, p)
  31     res = sum(y * sp.log(p) + sp.subtract(1, y) * sp.log(sp.subtract(1, p)))
  32     res *= -1.0/len(y)
  33     return res
  34 
  35 
  36 def multiclass_logloss(P, Y):
  37     npreds = [P[i][Y[i]-1] for i in range(len(Y))]
  38     score = -(1. / len(Y)) * np.sum(np.log(npreds))
  39     return score
  40 
  41 
  42 def accuracy(p, y):
  43     return np.mean([a == b for a, b in zip(p, y)])
  44 
  45 
  46 def probas_to_classes(y_pred):
  47     if len(y_pred.shape) > 1 and y_pred.shape[1] > 1:
  48         return categorical_probas_to_classes(y_pred)
  49     return np.array([1 if p > 0.5 else 0 for p in y_pred])
  50 
  51 
  52 def categorical_probas_to_classes(p):
  53     return np.argmax(p, axis=1)
  54
  [end of keras/utils/np_utils.py]
  </code>
  
  I need you to solve this issue by generating a single patch file that I can apply directly to this repository using git apply. Please respond with a single patch file in the following format.
  <patch>
  diff --git a/file.py b/file.py
  --- a/file.py
  +++ b/file.py
  @@ -1,27 +1,35 @@
   def euclidean(a, b):
  -    while b:
  -        a, b = b, a % b
  -    return a
  +    if b == 0:
  +        return a
  +    return euclidean(b, a % b)
   
   
   def bresenham(x0, y0, x1, y1):
       points = []
       dx = abs(x1 - x0)
       dy = abs(y1 - y0)
  -    sx = 1 if x0 < x1 else -1
  -    sy = 1 if y0 < y1 else -1
  -    err = dx - dy
  +    x, y = x0, y0
  +    sx = -1 if x0 > x1 else 1
  +    sy = -1 if y0 > y1 else 1
   
  -    while True:
  -        points.append((x0, y0))
  -        if x0 == x1 and y0 == y1:
  -            break
  -        e2 = 2 * err
  -        if e2 > -dy:
  -            err -= dy
  -            x0 += sx
  -        if e2 < dx:
  -            err += dx
  -            y0 += sy
  +    if dx > dy:
  +        err = dx / 2.0
  +        while x != x1:
  +            points.append((x, y))
  +            err -= dy
  +            if err < 0:
  +                y += sy
  +                err += dx
  +            x += sx
  +    else:
  +        err = dy / 2.0
  +        while y != y1:
  +            points.append((x, y))
  +            err -= dx
  +            if err < 0:
  +                x += sx
  +                err += dy
  +            y += sy
  +
  +    points.append((x, y))
       return points
  
  </patch>
golden_diff: diff --git a/keras/utils/np_utils.py b/keras/utils/np_utils.py
  --- a/keras/utils/np_utils.py
  +++ b/keras/utils/np_utils.py
  @@ -9,7 +9,6 @@
       '''Convert class vector (integers from 0 to nb_classes)
       to binary class matrix, for use with categorical_crossentropy.
       '''
  -    y = np.asarray(y, dtype='int32')
       if not nb_classes:
           nb_classes = np.max(y)+1
       Y = np.zeros((len(y), nb_classes))
  
verification_info: {"golden_diff": "diff --git a/keras/utils/np_utils.py b/keras/utils/np_utils.py\n--- a/keras/utils/np_utils.py\n+++ b/keras/utils/np_utils.py\n@@ -9,7 +9,6 @@\n     '''Convert class vector (integers from 0 to nb_classes)\n     to binary class matrix, for use with categorical_crossentropy.\n     '''\n-    y = np.asarray(y, dtype='int32')\n     if not nb_classes:\n         nb_classes = np.max(y)+1\n     Y = np.zeros((len(y), nb_classes))\n", "issue": "Textual information for labels?\nI seem unable to use text for labels, whilst using to_categorical\n\n```\nUsing Theano backend.\nTraceback (most recent call last):\n  File \"playground.py\", line 88, in <module>\n    train_model_and_test(number_of_epochs, number_of_classes, train_data, train_label, augmented_data_generator)\n  File \"playground.py\", line 62, in train_model_and_test\n    train_label = np_utils.to_categorical(train_label, number_of_classes)\n  File \"/usr/local/lib/python2.7/dist-packages/keras/utils/np_utils.py\", line 12, in to_categorical\n    y = np.asarray(y, dtype='int32')\n  File \"/usr/lib/python2.7/dist-packages/numpy/core/numeric.py\", line 460, in asarray\n    return array(a, dtype, copy=False, order=order)\nValueError: invalid literal for int() with base 10: 'yellow'\n```\n\n", "before_files": [{"content": "from __future__ import absolute_import\nimport numpy as np\nimport scipy as sp\nfrom six.moves import range\nfrom six.moves import zip\n\n\ndef to_categorical(y, nb_classes=None):\n    '''Convert class vector (integers from 0 to nb_classes)\n    to binary class matrix, for use with categorical_crossentropy.\n    '''\n    y = np.asarray(y, dtype='int32')\n    if not nb_classes:\n        nb_classes = np.max(y)+1\n    Y = np.zeros((len(y), nb_classes))\n    for i in range(len(y)):\n        Y[i, y[i]] = 1.\n    return Y\n\n\ndef normalize(a, axis=-1, order=2):\n    l2 = np.atleast_1d(np.linalg.norm(a, order, axis))\n    l2[l2 == 0] = 1\n    return a / np.expand_dims(l2, axis)\n\n\ndef binary_logloss(p, y):\n    epsilon = 1e-15\n    p = sp.maximum(epsilon, p)\n    p = sp.minimum(1-epsilon, p)\n    res = sum(y * sp.log(p) + sp.subtract(1, y) * sp.log(sp.subtract(1, p)))\n    res *= -1.0/len(y)\n    return res\n\n\ndef multiclass_logloss(P, Y):\n    npreds = [P[i][Y[i]-1] for i in range(len(Y))]\n    score = -(1. / len(Y)) * np.sum(np.log(npreds))\n    return score\n\n\ndef accuracy(p, y):\n    return np.mean([a == b for a, b in zip(p, y)])\n\n\ndef probas_to_classes(y_pred):\n    if len(y_pred.shape) > 1 and y_pred.shape[1] > 1:\n        return categorical_probas_to_classes(y_pred)\n    return np.array([1 if p > 0.5 else 0 for p in y_pred])\n\n\ndef categorical_probas_to_classes(p):\n    return np.argmax(p, axis=1)\n", "path": "keras/utils/np_utils.py"}]}