python/methylnet/interpretation_classes.py
def return_predict_function(model, cuda):
    """Decorator to build the supplied prediction function, important for kernel explanations.

    Parameters
    ----------
    model : type
        Prediction function with predict method.
    cuda : type
        Run using cuda.

    Returns
    -------
    function
        Predict function.

    """

    def predict(loader): # model can be VAE_MLP, TybaltTitusVAE, or CVAE
        model.eval()
        outputs=[]
        for input in loader:
            input=Variable(input)
            if cuda:
                input = input.cuda()
            outputs.append(np.squeeze(model.forward_predict(input).detach().cpu().numpy()))
        outputs=np.vstack(outputs)
        return outputs
    return predict
Decorator to build the supplied prediction function, important for kernel explanations.

    Parameters
    ----------
    model : type
        Prediction function with predict method.
    cuda : type
        Run using cuda.

    Returns
    -------
    function
        Predict function.

    
Decorator to build the supplied prediction function, important for kernel explanations.
Parameters

model : type
Prediction function with predict method.
cuda : type
Run using cuda.

Returns

function
Predict function.
Decorator to build the supplied prediction function important for kernel explanations . Parameters model : type Prediction function with predict method . cuda : type Run using cuda . Returns function Predict function .
def return_predict_function(model, cuda):
    def predict(loader): 
        model.eval()
        outputs=[]
        for input in loader:
            input=Variable(input)
            if cuda:
                input = input.cuda()
            outputs.append(np.squeeze(model.forward_predict(input).detach().cpu().numpy()))
        outputs=np.vstack(outputs)
        return outputs
    return predict
def return_predict_function ( model , cuda ) : def predict ( loader ) : model . eval ( ) outputs = [ ] for input in loader : input = Variable ( input ) if cuda : input = input . cuda ( ) outputs . append ( np . squeeze ( model . forward_predict ( input ) . detach ( ) . cpu ( ) . numpy ( ) ) ) outputs = np . vstack ( outputs ) return outputs return predict
Decorator to build the supplied prediction function, important for kernel explanations.
Decorator to build the supplied prediction function important for kernel explanations .
"""Decorator to build the supplied prediction function, important for kernel explanations.

    Parameters
    ----------
    model : type
        Prediction function with predict method.
    cuda : type
        Run using cuda.

    Returns
    -------
    function
        Predict function.

    """ # model can be VAE_MLP, TybaltTitusVAE, or CVAE
model
cuda