synthcity icon indicating copy to clipboard operation
synthcity copied to clipboard

PydanticUserError in schema.py

Open AsafKov opened this issue 4 months ago • 1 comments

Description

In tutorial0 (or wherever Plugins is used) I encounter the following error: A non-annotated attribute was detected: protected_cols = ['seq_id']. All model fields require a type annotation; if protected_cols is not meant to be a field, you may be able to resolve this error by annotating it as a ClassVar or updating model_config['ignored_types'].

protected_cols is defined in schema.py: `class Schema(BaseModel): """ .. inheritance-diagram:: synthcity.plugins.core.schema.Schema :parts: 1

Utility class for defining the schema of a Dataset.

Constructor Args:
    domain: Dict
        A dictionary of feature_name: Distribution.
    sampling_strategy: str
        Taking value of "marginal" (default) or "uniform" (for debugging).
    protected_cols: List[str]
        List of columns that are exempt from distributional constraints (e.g. ID column)
    random_state: int
        Random seed (default 0)
    data: Any
        (Optional) the data set
"""

sampling_strategy: str = "marginal"  # uniform or marginal
protected_cols = ["seq_id"]
random_state: int = 0
data: Any = None
domain: Dict = {}`

How to Reproduce

Clone repository, install synthcity and run tutorial0 or import Plugins.

Expected Behavior

Screenshots

System Information

  • OS: Windows
  • OS Version: 11
  • Language Version: Python 3.11.8
  • Package Manager Version:
  • Browser (if applicable):
  • Browser Version (if applicable):

Additional Context

Add any other context about the problem here.

AsafKov avatar Feb 17 '24 16:02 AsafKov