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

Add base class for metrics in metrics/base.py #5

Merged
merged 3 commits into from
Aug 17, 2023

Conversation

sweep-ai[bot]
Copy link
Contributor

@sweep-ai sweep-ai bot commented Aug 17, 2023

Description

This PR adds a base class for metrics in the metrics/base.py file. The base class, BaseMetric, provides a foundation for implementing various metrics that can evaluate the similarity between synthetic and real datasets.

Summary

  • Removed the pass statement from the metrics/base.py file.
  • Imported the ABC and abstractmethod from the abc module.
  • Created a new class named BaseMetric that inherits from ABC.
  • Defined an __init__ method in the BaseMetric class to store the real_data and synthetic_data as instance variables.
  • Defined an abstract method named calculate in the BaseMetric class to calculate the metric. This method will be implemented in each subclass.
  • Defined a method named validate_datasets in the BaseMetric class to validate the input datasets. Currently, this method does not perform any validation.

Please review and merge this PR. Thank you!

Fixes #3.


To checkout this PR branch, run the following command in your terminal:

git checkout sweep/add-base-class-for-metrics

To get Sweep to edit this pull request, leave a comment below or in the code. Leaving a comment in the code will only modify the file but commenting below can change the entire PR.

@sweep-ai sweep-ai bot added the sweep Assigns Sweep to an issue or pull request. label Aug 17, 2023
@sweep-ai
Copy link
Contributor Author

sweep-ai bot commented Aug 17, 2023

GitHub actions yielded the following error.

The command that failed is pre-commit run --show-diff-on-failure --color=always --all-files. Here are the relevant lines from the logs:

black....................................................................�[41mFailed�[m
�[2m- hook id: black�[m
�[2m- files were modified by this hook�[m

�[1mreformatted sdgx/metrics/base.py�[0m

�[1mAll done! ✨ 🍰 ✨�[0m
�[34m�[1m1 file �[0m�[1mreformatted�[0m, �[34m24 files �[0mleft unchanged.

isort....................................................................�[42mPassed�[m
pre-commit hook(s) made changes.
If you are seeing this message in CI, reproduce locally with: `pre-commit run --all-files`.
To run `pre-commit` as part of git workflow, use `pre-commit install`.
All changes made by hooks:
�[1mdiff --git a/sdgx/metrics/base.py b/sdgx/metrics/base.py�[m
�[1mindex 3926741..97efb02 100644�[m
�[1m--- a/sdgx/metrics/base.py�[m
�[1m+++ b/sdgx/metrics/base.py�[m
�[36m@@ -1,5 +1,6 @@�[m
from abc import ABC, abstractmethod�[m
�[m
�[32m+�[m
class BaseMetric(ABC):�[m
def __init__(self, real_data, synthetic_data):�[m
self.real_data = real_data�[m
##[error]Process completed with exit code 1.

There are a lot of errors. This is likely due to a small parsing issue or a missing import with the files changed in the PR.

This is likely a linting or type-checking issue with the source code. Update the code changed by the PR. Don't modify the existing tests.

I'm getting the same errors 3 times in a row, so I will stop working on fixing this PR.

Copy link
Contributor

@MooooCat MooooCat left a comment

Choose a reason for hiding this comment

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

Approved

@MooooCat MooooCat merged commit 2c474f5 into main Aug 17, 2023
5 checks passed
@MooooCat MooooCat deleted the sweep/add-base-class-for-metrics branch August 17, 2023 03:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
sweep Assigns Sweep to an issue or pull request.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Sweep: add a base class of metrics which can evaluate how similar the synthetic dataset is to real dataset
1 participant