def process(task):

    # import modules required by engine
    import os
    import subprocess
    from mrec import load_sparse_matrix, save_recommender

    model,input_format,trainfile,feature_format,featurefile,outfile,offset,step = task

    dataset = load_sparse_matrix(input_format,trainfile)
    if featurefile is not None:
        # currently runs much faster if features are loaded as a dense matrix
        item_features = load_sparse_matrix(feature_format,featurefile).toarray()
        # strip features for any trailing items that don't appear in training set
        num_items = dataset.shape[1]
        item_features = item_features[:num_items,:]
        model.fit(dataset,item_features=item_features)
    else:
        model.fit(dataset)
    save_recommender(model,outfile)

    # record success
    cmd = ['touch','{0}.SUCCESS'.format(outfile)]
    subprocess.check_call(cmd)

    # return the offset for the samples that we've learned from
    return offset
Analytical derivatives.
dataset/ETHPy150Open Mendeley/mrec/mrec/parallel/warp.py/process--crossover with--dataset/ETHPy150Open OpenMDAO/OpenMDAO/examples/fd_comp_example.py/SimpleComp.linearize