def unhot(function):
 def wrapper(actual, predicted):
  if ((len(actual.shape) > 1) and (actual.shape[1] > 1)):
   actual = actual.argmax(axis=1)
  if ((len(predicted.shape) > 1) and (predicted.shape[1] > 1)):
   predicted = predicted.argmax(axis=1)
  return function(actual, predicted)
 return wrapper

def unhot ( function ) : def wrapper ( actual , predicted ) : if ( ( len ( actual . shape ) > 1 ) and ( actual . shape [ 1 ] > 1 ) ) : actual = actual . argmax ( axis = 1 ) if ( ( len ( predicted . shape ) > 1 ) and ( predicted . shape [ 1 ] > 1 ) ) : predicted = predicted . argmax ( axis = 1 ) return function ( actual , predicted ) return wrapper
convert one-hot representation into one column .