

def process(task):
    '\n    Training task to run on an ipython engine.\n    '
    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):
        item_features = load_sparse_matrix(feature_format, featurefile).toarray()
        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)
    cmd = ['touch', '{0}.SUCCESS'.format(outfile)]
    subprocess.check_call(cmd)
    return offset

dataset/ETHPy150Open Mendeley/mrec/mrec/parallel/warp.py process/original