PaddleRec/ncf/evaluate.py
def evaluate_model(args, testRatings, testNegatives, K, model_path):
    """
    Evaluate the performance (Hit_Ratio, NDCG) of top-K recommendation
    Return: score of each test rating.
    """
    global _model
    global _testRatings
    global _testNegatives
    global _K
    global _model_path 
    global _args
    
    _args = args
    _model_path= model_path
    _testRatings = testRatings
    _testNegatives = testNegatives
    _K = K
        
    hits, ndcgs = [],[]
    for idx in range(len(_testRatings)):
        (hr,ndcg) = eval_one_rating(idx)
        hits.append(hr)
        ndcgs.append(ndcg)      
    return (hits, ndcgs)

    Evaluate the performance (Hit_Ratio, NDCG) of top-K recommendation
    Return: score of each test rating.
    
Evaluate the performance (Hit_Ratio, NDCG) of top-K recommendation
Return: score of each test rating.
Evaluate the performance ( Hit_Ratio NDCG ) of top - K recommendation Return : score of each test rating .
def evaluate_model(args, testRatings, testNegatives, K, model_path):
    global _model
    global _testRatings
    global _testNegatives
    global _K
    global _model_path 
    global _args
    _args = args
    _model_path= model_path
    _testRatings = testRatings
    _testNegatives = testNegatives
    _K = K
    hits, ndcgs = [],[]
    for idx in range(len(_testRatings)):
        (hr,ndcg) = eval_one_rating(idx)
        hits.append(hr)
        ndcgs.append(ndcg)      
    return (hits, ndcgs)
def evaluate_model ( args , testRatings , testNegatives , K , model_path ) : global _model global _testRatings global _testNegatives global _K global _model_path global _args _args = args _model_path = model_path _testRatings = testRatings _testNegatives = testNegatives _K = K hits , ndcgs = [ ] , [ ] for idx in range ( len ( _testRatings ) ) : ( hr , ndcg ) = eval_one_rating ( idx ) hits . append ( hr ) ndcgs . append ( ndcg ) return ( hits , ndcgs )
Evaluate the performance (Hit_Ratio, NDCG) of top-K recommendation
Return: score of each test rating.
Evaluate the performance ( Hit_Ratio NDCG ) of top - K recommendation Return : score of each test rating .
"""
    Evaluate the performance (Hit_Ratio, NDCG) of top-K recommendation
    Return: score of each test rating.
    """
args
testRatings
testNegatives
K
model_path