def svm_loss(model_table, dat_table, label, arr, epoch): ''' Compute the SVM loss ''' return iutil.bismarck_query( 'sum(svmloss(__PREV_MODEL__, %(arr)s, %(label)s))' % { 'arr': arr, 'label': label }, model_table, dat_table, epoch, label)
def logr_loss(model_table, dat_table, label, arr, epoch): ''' Computes the loss for each example in the data table @param model_table: name of table to store models @param dat_table: name of table we iterate over @param label: name of label column @param arr: UDF that returns an double array stored as a string @param epoch: the epoch number (which model # to use when computing the loss) ''' return iutil.bismarck_query('logrloss(__PREV_MODEL__, %(arr)s, %(label)s)' % {'arr':arr, 'label':label}, model_table, dat_table, epoch, label)
def svm_loss(model_table, dat_table, label, arr, epoch): ''' Compute the SVM loss ''' return iutil.bismarck_query('sum(svmloss(__PREV_MODEL__, %(arr)s, %(label)s))' % {'arr':arr, 'label':label}, model_table, dat_table, epoch, label)