Module Import alias identifier FunctionDef arguments args NameParam NameParam NameParam defaults Num body Expr Str If CompareGt Call NameLoad NameLoad NameLoad body Assign NameStore SubscriptLoad NameLoad Slice NameLoad Assign NameStore Num Assign NameStore Num For TupleStore NameStore NameStore Call NameLoad NameLoad body If BoolOpAnd CompareIn NameLoad NameLoad CompareNotIn NameLoad SubscriptLoad NameLoad Slice NameLoad body AugAssignAdd NameStore Num AugAssignAdd NameStore BinOpDiv NameLoad BinOpAdd NameLoad Num If UnaryOpNot NameLoad body Return Num Return BinOpDiv NameLoad Call NameLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults Num body Expr Str Return Call AttributeLoad NameLoad attr ListComp Call NameLoad NameLoad NameLoad NameLoad comprehension TupleStore NameStore NameStore Call NameLoad NameLoad NameLoad decorator_list
N/A N/A numpy np kdd_apk N/A N/A actual predicted k N/A 10 N/A N/A 
    Computes the average precision at k for Track 1 of the 2012 KDD Cup.

    This modified version uses the number of actual clicks as the denominator,
    regardless of k.

    This function computes the average prescision at k between two lists of
    items.

    Parameters
    ----------
    actual : list
             A list of elements that are to be predicted (order doesn't matter)
    predicted : list
                A list of predicted elements (order does matter)
    k : int, optional
        The maximum number of predicted elements

    Returns
    -------
    score : double
            The average precision at k over the input lists

     N/A N/A N/A len predicted k N/A N/A predicted N/A predicted N/A k N/A score 0.0 N/A num_hits 0.0 N/A N/A i p N/A enumerate predicted N/A N/A N/A N/A p actual N/A p N/A predicted N/A i N/A N/A num_hits 1.0 N/A score N/A num_hits N/A i 1.0 N/A N/A actual N/A N/A 0.0 N/A N/A score N/A len actual N/A kdd_mapk N/A N/A actual predicted k N/A 10 N/A N/A 
    Computes the mean average precision at k for Track 1 of the 2012 KDD Cup.

    This modified version uses the number of actual clicks as the denominator,
    regardless of k.

    This function computes the mean average prescision at k between two lists
    of lists of items.

    Parameters
    ----------
    actual : list
             A list of lists of elements that are to be predicted 
             (order doesn't matter in the lists)
    predicted : list
                A list of lists of predicted elements
                (order matters in the lists)
    k : int, optional
        The maximum number of predicted elements

    Returns
    -------
    score : double
            The mean average precision at k over the input lists

     N/A N/A N/A np mean N/A N/A kdd_apk a p k N/A N/A a p N/A zip actual predicted N/A