Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Evaluator cannot return the expected metrics. #2078

Closed
lcy-seso opened this issue May 10, 2017 · 5 comments · Fixed by #2165
Closed

Evaluator cannot return the expected metrics. #2078

lcy-seso opened this issue May 10, 2017 · 5 comments · Fixed by #2165
Assignees
Labels

Comments

@lcy-seso
Copy link
Contributor

lcy-seso commented May 10, 2017

In V2 API, by default, the following codes print a certain metric calculated by an evaluator.

def event_handler(event):
        if isinstance(event, paddle.event.EndIteration):
            if event.batch_id % 100 == 0:
                print "\nPass %d, Batch %d, Cost %f, %s" % (
                    event.pass_id, event.batch_id, event.cost, event.metrics)

In the C++ implementation, an evaluator stores the evaluation results in Argument, and there are also some evaluators that store nothing but just print to stderr.

The above code can only print the evaluated stored in Argument.value. If any of the following two situations happens, the evaluator cannot return a right result.

  1. An evaluator stores multiple evaluated metrics in a special format.
  2. An evaluator does not store the evaluated metrics but just print, for example, the chuck evaluator.

For the fist case, there should be some documentations to explain how each evaluator stores its results.

For the second case, the original C++ codes need to be modified.

Does anyone test that in V2 API every evaluator returns the right results?

@lcy-seso lcy-seso self-assigned this May 10, 2017
@lcy-seso lcy-seso added the Bug label May 10, 2017
@lcy-seso lcy-seso added this to 全局BUG in V2 API Enhancement May 10, 2017
@lcy-seso lcy-seso added this to Top priorities in Defects board May 10, 2017
@lcy-seso lcy-seso moved this from Not in schedule to Next Week in Defects board May 10, 2017
@lcy-seso lcy-seso moved this from Next Week to Current Week ToDo in Defects board May 10, 2017
@reyoung
Copy link
Collaborator

reyoung commented May 10, 2017

Could we fix this bug by making Evaluator can return many types in Python?

Just print to stderr is really a bad design in Paddle. If an Evaluator could return any types of metrics, it seems would fix this bug. For example, if we use beam search evaluator, we could get the result sentences in metrics.

@reyoung
Copy link
Collaborator

reyoung commented May 10, 2017

I also think Evaluator in Paddle is an overused concept. Just tell me why we need print Evaluator when we can get any layer's output in Python?

@lcy-seso lcy-seso moved this from Current Week ToDo to Next Week in Defects board May 10, 2017
@lcy-seso lcy-seso moved this from Next Week to Not in schedule in Defects board May 10, 2017
@lcy-seso
Copy link
Contributor Author

lcy-seso commented May 10, 2017

@reyoung I think the problem is we should disable some evaluators that only to print, and formalize evaluators that do not store their results in Arguments, so that they can work with v2 API better.

@reyoung reyoung moved this from Not in schedule to Next Week in Defects board May 10, 2017
@lcy-seso
Copy link
Contributor Author

@pkuyym will fix this bug.

@pkuyym
Copy link
Contributor

pkuyym commented May 16, 2017

@lcy-seso @reyoung
I find that the v2 api will call getValue in a loop to retrieve all metrics calculated by ChunkEvaluator. So I just implement corresponding virtual functions of ChunkEvaluator to return Precision、Recall and F1-Score. Functions I implemented are getTypegetNames and getValue. Please feel free to point out what I've missed.

@pkuyym pkuyym mentioned this issue May 16, 2017
@lcy-seso lcy-seso moved this from Next Week to Done in Defects board May 22, 2017
@lcy-seso lcy-seso removed this from Done in Defects board May 22, 2017
@luotao1 luotao1 moved this from 全局BUG to 已完成 in V2 API Enhancement May 25, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Development

Successfully merging a pull request may close this issue.

3 participants