vanderschaarlab / synthcity

A library for generating and evaluating synthetic tabular data for privacy, fairness and data augmentation.
https://www.vanderschaar-lab.com/
Apache License 2.0
442 stars 58 forks source link

PydanticUserError in schema.py #256

Open AsafKov opened 8 months ago

AsafKov commented 8 months ago

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

Additional Context

Add any other context about the problem here.

7Dt3V5TmzAtfur commented 6 months ago

import pydantic print(pydantic.version)

try pip install pydantic==1.10.15