GithubHelp home page GithubHelp logo

Comments (5)

guody5 avatar guody5 commented on May 12, 2024

Hi @deplay, thanks for your pointing problem.
I have modified the metric calculation.

def calculate_scores(answers,predictions):
    scores=[]
    for key in answers:
        if key not in predictions:
            logging.error("Missing prediction for index {}.".format(key))
            sys.exit()

        answer = set(answers[key])   

        Avep = []
        for k, p in enumerate(predictions[key]):
            if p in answer:
                Avep.append((len(Avep)+1)/(k+1))

        scores.append(sum(Avep)/len(answer))

    result={}
    result['MAP']= round(np.mean(scores),4)
    return result

Can you please check whether it's correct?

from codexglue.

guody5 avatar guody5 commented on May 12, 2024

In fact, we follow this paper in C.4 Evaluation Metrics. According the description of paper, the MAP@R is defined as the mean of average precision scores, each of which is evaluated for retrieving R most similar samples given a query. In our case, the set of queries is the set of all test programs. For a program, R is the number of other programs in the same class, i.e. R=499. Therefore, the calculation is same as the paper and all results are comparable. For distinguishing them, we follow the paper and call MAP@R instead of MAP.

from codexglue.

deplay avatar deplay commented on May 12, 2024

MISIM https://arxiv.org/pdf/2006.05265.pdf refers another paper Musgrave et.al A Metric Learning Reality Check, 2020. https://arxiv.org/pdf/2003.08505.pdf

In Musgrave's paper,they provide following contents:

image
image

In CodeXGLUE/Code-Code/Clone-detection-POJ-104/evaluator/evaluator.py,the essential implementation "scores.append(len(set(a&p))/len(a))" seems calculate R-Precision rather than MAP@R

from codexglue.

guody5 avatar guody5 commented on May 12, 2024

You are right. Thanks. We have corrected the evaluator.py and update the results.

from codexglue.

deplay avatar deplay commented on May 12, 2024

the implementation seems ok, and you may want to update here.
image

from codexglue.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.