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 model for multi-table statistic model, change single-table base class location #102

Merged
merged 27 commits into from
Jan 16, 2024

Conversation

MooooCat
Copy link
Contributor

@MooooCat MooooCat commented Jan 11, 2024

Description

  • Add base model for multi-table statistic model.
  • Change single-table base class location.
  • Change check settings in metadata.

Motivation and Context

The main purpose of this change is to adapt to multi-table synthetic data scenarios

How has this been tested?

A test case has been provided for the method of base class.

Types of changes

  • Maintenance (no change in code, maintain the project's CI, docs, etc.)
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.

@codecov-commenter
Copy link

codecov-commenter commented Jan 12, 2024

Codecov Report

Attention: 17 lines in your changes are missing coverage. Please review.

Comparison is base (f18b552) 78.68% compared to head (01b1749) 78.99%.

Files Patch % Lines
sdgx/models/statistics/multi_tables/base.py 83.58% 11 Missing ⚠️
sdgx/models/base.py 76.92% 3 Missing ⚠️
sdgx/data_models/metadata.py 50.00% 2 Missing ⚠️
sdgx/models/statistics/single_table/base.py 0.00% 1 Missing ⚠️

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #102      +/-   ##
==========================================
+ Coverage   78.68%   78.99%   +0.30%     
==========================================
  Files          61       62       +1     
  Lines        2599     2680      +81     
==========================================
+ Hits         2045     2117      +72     
- Misses        554      563       +9     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@MooooCat MooooCat requested a review from Z712023 January 15, 2024 04:49
@MooooCat MooooCat marked this pull request as ready for review January 15, 2024 05:31
@Wh1isper
Copy link
Collaborator

Nice PR, and I have a couple questions:

  • Why does MultiTableSynthesizerModel inherit from pydantic.BaseModel, given that he doesn't seem to be a data object.
  • If you want to accept streaming files(DataLoader) or Dataframe for evaluation, you only need to define the two mutually exclusive parameters raw_data and dataloader in the kwargs, what is the importance of the enum class DataAccessType?
    • Also, if the raw_data parameter needs to be added, one might want to consider how the existing architecture extends this parameter

@MooooCat
Copy link
Contributor Author

  • Why does MultiTableSynthesizerModel inherit from pydantic.BaseModel, given that he doesn't seem to be a data object.

Regarding this question, it mainly comes from my lack of understanding of pydantic.BaseModel. Before that, I thought it was just a base class convenient for developer to implement. After checking, I found that:

"Pydantic is the most widely used data validation library for Python. ”

this is indeed inconsistent with the purpose of a statistical model.

@Z712023
Copy link
Collaborator

Z712023 commented Jan 16, 2024

Offer fuel on snowy weather! Multi-table model is what we want!

Copy link
Collaborator

@Z712023 Z712023 left a comment

Choose a reason for hiding this comment

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

The validation in metadata is ok!

@MooooCat
Copy link
Contributor Author

Offer fuel on snowy weather! Multi-table model is what we want!

There will be some minor modifications before merge.

MooooCat and others added 3 commits January 16, 2024 12:40
- remove `DataAccessType`
- remove `pydantic.BaseModel`
- set two mutually exclusive parameters `use_raw_data` and `use_dataloader` in `sdgx.models.base.SynthesizerModel`
- some other necessary modifications
@MooooCat
Copy link
Contributor Author

  • Why does MultiTableSynthesizerModel inherit from pydantic.BaseModel, given that he doesn't seem to be a data object.
  • If you want to accept streaming files(DataLoader) or Dataframe for evaluation, you only need to define the two mutually exclusive parameters raw_data and dataloader in the kwargs, what is the importance of the enum class DataAccessType?
    • Also, if the raw_data parameter needs to be added, one might want to consider how the existing architecture extends this parameter

I removed the pydantic.BaseModel, and use sdgx.models.base.SynthesizerModel instead.

I removed the DataAccessType and set two mutually exclusive parameters use_raw_data and use_dataloader in sdgx.models.base.SynthesizerModel, this base class will be inherit by all ML and statistic models.

In existing architecture, I think it's OK to simply set use_raw_data to True or use_dataloader to True.

In the future, we can add support for these two data access methods . (I leave this to future, not in this PR).

Currently, this modification does not affect the use of existing models.

Copy link
Collaborator

@Wh1isper Wh1isper left a comment

Choose a reason for hiding this comment

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

I prefer to merge it now and make further improvements in the implementation of multi-table simulations.

@MooooCat MooooCat merged commit d29a2a0 into main Jan 16, 2024
11 checks passed
@MooooCat MooooCat deleted the refactoring-base-model-partitial branch January 16, 2024 09:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants