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

[Refactor] Refactor Evaluator #822

Merged
merged 4 commits into from
Apr 29, 2024
Merged

[Refactor] Refactor Evaluator #822

merged 4 commits into from
Apr 29, 2024

Conversation

zhjwy9343
Copy link
Contributor

@zhjwy9343 zhjwy9343 commented Apr 29, 2024

Issue #757, if available:

Description of changes:
This PR includes code refactor of GraphStorm "Evaluators". And all codes, examples and documentations are refactored accordingly.

The major changes include:

  1. Unified GSgnnInstanceEvaluator and GSgnnLPEvaluator classes with GSgnnBaseEvaluator plus interface classes, i.e., GSgnnPredictionEvalInterface and GSgnnLPRankingEvalInterface. In such way, all sub evaluators share the same properties, and also can have different evaluation methods according to the interfaces they implemented.
  2. Replaced GSgnnAccEvaluator with GSgnnClassificationEvaluator, which is implemented by extending GSgnnBaseEvaluator and GSgnnPredictionEvalInterface. Its behavior is nearly the same as the GSgnnAccEvaluator.
  3. Modified GSgnnRegressionEvaluator in the new way by extending GSgnnBaseEvaluator and GSgnnPredictionEvalInterface, and unified its behavior as GSgnnClassificationEvaluator.
  4. Modified GSgnnMrrLPEvaluator and GSgnnPerEtypeMrrLPEvaluator in the new way by extending GSgnnBaseEvaluator and GSgnnRankingLPEvalInterface.

The detailed changes are:

  1. GSgnnBaseEvaluator separates evaluator properties from abstract methods, i.e., evaluate() and compute_score(), which are defined in the interface classes.
  2. GSgnnPredictionEvalInterface defines the evaluate() and compute_score() methods for classification and regression tasks, which ask for both predictions and labels as inputs.
  3. GSgnnRankingEvalInterface defines the evaluate() and compute_score() methods for ranking-based LP tasks, which ask for ranking values as inputs.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

zhjwy9343 and others added 3 commits April 18, 2024 08:41
*Issue #757 , if available:*

*Description of changes:*
This PR is the 1st one of a sequence PRs that create new `Evaluator`
classes to replace the current `GSgnnInstanceEvaluator`,
`GSgnnAccEvaluator`, `GSgnnRegressionEvaluator`, and `GSgnnLPEvaluator`.

This PR create the base `GSgnnBaseEvaluator` to replace the current
`GSgnnInstanceEvaluator` and `GSgnnLPEvaluator`, and
the`GSgnnClassificationEvaluator`, which extends from the base and
replace the current `GSgnnAccEvaluator`. This PR also replace all
occurrence of `GSgnnAccEvaluator` in core code, examples, documents, and
tests.

By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice.

---------

Co-authored-by: Ubuntu <[email protected]>
Co-authored-by: Ubuntu <[email protected]>
*Issue #757, if available:*

*Description of changes:*
This is the 2nd PR of the Evaluator refactor work, which adds
`GSgnnRegressionEvaluator`, `GSgnnLPEvaluator`, and
`GSgnnPerEtypeLPEvaluator`. In addition, this PR also change the name of
`GSgnnLPEvalInterface` to `GSgnnMrrLPEvalInterface`, making the meaning
of the interface more clear.

By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice.

---------

Co-authored-by: Ubuntu <[email protected]>
…819)

*Issue #, if available:*

*Description of changes:*
This is the final PR for evaluator refactoring, which refines the doc
string of evaluators.

By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice.

Co-authored-by: Ubuntu <[email protected]>
@zhjwy9343 zhjwy9343 added 0.3 ready able to trigger the CI labels Apr 29, 2024
@zhjwy9343 zhjwy9343 requested a review from classicsong April 29, 2024 06:52
@classicsong
Copy link
Contributor

Please add the API changes in to PR description if any.

Copy link
Contributor

@classicsong classicsong left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@classicsong classicsong merged commit 51c6a95 into main Apr 29, 2024
11 checks passed
@classicsong classicsong deleted the refactor-evaluator branch April 29, 2024 21:11
thvasilo pushed a commit to thvasilo/graphstorm that referenced this pull request May 17, 2024
*Issue awslabs#757, if available:*

*Description of changes:*
This PR includes code refactor of GraphStorm "**Evaluators**". And all
codes, examples and documentations are refactored accordingly.

The major changes include:

1. Unified `GSgnnInstanceEvaluator` and `GSgnnLPEvaluator` classes with
`GSgnnBaseEvaluator` plus interface classes, i.e.,
`GSgnnPredictionEvalInterface` and `GSgnnLPRankingEvalInterface`. In
such way, all sub evaluators share the same properties, and also can
have different evaluation methods according to the interfaces they
implemented.
2. Replaced `GSgnnAccEvaluator` with `GSgnnClassificationEvaluator`,
which is implemented by extending `GSgnnBaseEvaluator` and
`GSgnnPredictionEvalInterface`. Its behavior is nearly the same as the
`GSgnnAccEvaluator`.
3. Modified `GSgnnRegressionEvaluator` in the new way by extending
`GSgnnBaseEvaluator` and `GSgnnPredictionEvalInterface`, and unified its
behavior as `GSgnnClassificationEvaluator`.
4. Modified `GSgnnMrrLPEvaluator` and `GSgnnPerEtypeMrrLPEvaluator` in
the new way by extending `GSgnnBaseEvaluator` and
`GSgnnRankingLPEvalInterface`.

The detailed changes are:

1. `GSgnnBaseEvaluator` separates evaluator properties from abstract
methods, i.e., `evaluate()` and `compute_score()`, which are defined in
the interface classes.
2. `GSgnnPredictionEvalInterface` defines the `evaluate()` and
`compute_score()` methods for classification and regression tasks, which
ask for both predictions and labels as inputs.
3. `GSgnnRankingEvalInterface` defines the `evaluate()` and
`compute_score()` methods for ranking-based LP tasks, which ask for
ranking values as inputs.

By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice.

---------

Co-authored-by: Ubuntu <[email protected]>
Co-authored-by: Ubuntu <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants