'''
Created on Jan 25, 2017

@author: philip
'''
import numpy as np

def from_categorical(y_one_hot):
        
    y = np.zeros((y_one_hot.shape[0],))            
    itemindex = np.where(y_one_hot==1)
    y[itemindex[0]] = itemindex[1]
        
    return y
  
def prob_to_class(y_prob):
  the_class = np.argmax(y_prob, axis=1) 
  return the_class
