(f_log_probs, options, worddict, prepare_data, data, iterator, verbose=False)
return probs
Get log probabilities of captions
    Parameters
    ----------
    f_log_probs : theano function
        compute the log probability of a x given the context
    options : dict
        options dictionary
    worddict : dict
        maps words to one-hot encodings
    prepare_data : function
        see corresponding dataset class for details
    data : numpy array
        output of load_data, see corresponding dataset class
    iterator : KFold
        indices from scikit-learn KFold
    verbose : boolean
        if True print progress
    Returns
    -------
    probs : numpy array
        array of log probabilities indexed by example
Get log probabilities of captions
    Parameters
    ----------
    f_log_probs : theano function
        compute the log probability of a x given the context
    options : dict
        options dictionary
    worddict : dict
        maps words to one-hot encodings
    prepare_data : function
        see corresponding dataset class for details
    data : numpy array
        output of load_data, see corresponding dataset class
    iterator : KFold
        indices from scikit-learn KFold
    verbose : boolean
        if True print progress
    Returns
    -------
    probs : numpy array
        array of log probabilities indexed by example
Get log probabilities of captions Parameters ---------- f_log_probs : theano function compute the log probability of a x given the context options : dict options dictionary worddict : dict maps words to one - hot encodings prepare_data : function see corresponding dataset class for details data : numpy array output of load_data see corresponding dataset class iterator : KFold indices from scikit - learn KFold verbose : boolean if True print progress Returns ------- probs : numpy array array of log probabilities indexed by example
def pred_probs(f_log_probs, options, worddict, prepare_data, data, iterator, verbose=False):
    """ Get log probabilities of captions
    Parameters
    ----------
    f_log_probs : theano function
        compute the log probability of a x given the context
    options : dict
        options dictionary
    worddict : dict
        maps words to one-hot encodings
    prepare_data : function
        see corresponding dataset class for details
    data : numpy array
        output of load_data, see corresponding dataset class
    iterator : KFold
        indices from scikit-learn KFold
    verbose : boolean
        if True print progress
    Returns
    -------
    probs : numpy array
        array of log probabilities indexed by example
    """
    n_samples = len(data[0])
    probs = numpy.zeros((n_samples, 1)).astype('float32')

    n_done = 0

    for _, valid_index in iterator:
        x, mask, ctx = prepare_data([data[0][t] for t in valid_index],
                                     data[1],
                                     worddict,
                                     maxlen=None,
                                     n_words=options['n_words'])
        pred_probs = f_log_probs(x,mask,ctx)
        probs[valid_index] = pred_probs[:,None]

        n_done += len(valid_index)
        if verbose:
            print '%d/%d samples computed'%(n_done,n_samples)

    return probs
def pred_probs ( f_log_probs , options , worddict , prepare_data , data , iterator , verbose = False ) : n_samples = len ( data [ 0 ] ) probs = numpy . zeros ( ( n_samples , 1 ) ) . astype ( 'float32' ) n_done = 0 for _ , valid_index in iterator : x , mask , ctx = prepare_data ( [ data [ 0 ] [ t ] for t in valid_index ] , data [ 1 ] , worddict , maxlen = None , n_words = options [ 'n_words' ] ) pred_probs = f_log_probs ( x , mask , ctx ) probs [ valid_index ] = pred_probs [ : , None ] n_done += len ( valid_index ) if verbose : print '%d/%d samples computed' % ( n_done , n_samples ) return probs