mostlyai 4.0.6__tar.gz → 4.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {mostlyai-4.0.6 → mostlyai-4.1.0}/PKG-INFO +7 -7
- {mostlyai-4.0.6 → mostlyai-4.1.0}/mostlyai/sdk/__init__.py +1 -1
- {mostlyai-4.0.6 → mostlyai-4.1.0}/mostlyai/sdk/_data/file/container/azure.py +4 -1
- {mostlyai-4.0.6 → mostlyai-4.1.0}/mostlyai/sdk/domain.py +106 -86
- {mostlyai-4.0.6 → mostlyai-4.1.0}/pyproject.toml +7 -7
- {mostlyai-4.0.6 → mostlyai-4.1.0}/.gitignore +0 -0
- {mostlyai-4.0.6 → mostlyai-4.1.0}/LICENSE +0 -0
- {mostlyai-4.0.6 → mostlyai-4.1.0}/README.md +0 -0
- {mostlyai-4.0.6 → mostlyai-4.1.0}/mostlyai/sdk/_data/__init__.py +0 -0
- {mostlyai-4.0.6 → mostlyai-4.1.0}/mostlyai/sdk/_data/auto_detect.py +0 -0
- {mostlyai-4.0.6 → mostlyai-4.1.0}/mostlyai/sdk/_data/base.py +0 -0
- {mostlyai-4.0.6 → mostlyai-4.1.0}/mostlyai/sdk/_data/context.py +0 -0
- {mostlyai-4.0.6 → mostlyai-4.1.0}/mostlyai/sdk/_data/conversions.py +0 -0
- {mostlyai-4.0.6 → mostlyai-4.1.0}/mostlyai/sdk/_data/db/__init__.py +0 -0
- {mostlyai-4.0.6 → mostlyai-4.1.0}/mostlyai/sdk/_data/db/base.py +0 -0
- {mostlyai-4.0.6 → mostlyai-4.1.0}/mostlyai/sdk/_data/db/bigquery.py +0 -0
- {mostlyai-4.0.6 → mostlyai-4.1.0}/mostlyai/sdk/_data/db/databricks.py +0 -0
- {mostlyai-4.0.6 → mostlyai-4.1.0}/mostlyai/sdk/_data/db/hive.py +0 -0
- {mostlyai-4.0.6 → mostlyai-4.1.0}/mostlyai/sdk/_data/db/mssql.py +0 -0
- {mostlyai-4.0.6 → mostlyai-4.1.0}/mostlyai/sdk/_data/db/mysql.py +0 -0
- {mostlyai-4.0.6 → mostlyai-4.1.0}/mostlyai/sdk/_data/db/oracle.py +0 -0
- {mostlyai-4.0.6 → mostlyai-4.1.0}/mostlyai/sdk/_data/db/postgresql.py +0 -0
- {mostlyai-4.0.6 → mostlyai-4.1.0}/mostlyai/sdk/_data/db/snowflake.py +0 -0
- {mostlyai-4.0.6 → mostlyai-4.1.0}/mostlyai/sdk/_data/db/sqlite.py +0 -0
- {mostlyai-4.0.6 → mostlyai-4.1.0}/mostlyai/sdk/_data/db/types_coercion.py +0 -0
- {mostlyai-4.0.6 → mostlyai-4.1.0}/mostlyai/sdk/_data/dtype.py +0 -0
- {mostlyai-4.0.6 → mostlyai-4.1.0}/mostlyai/sdk/_data/exceptions.py +0 -0
- {mostlyai-4.0.6 → mostlyai-4.1.0}/mostlyai/sdk/_data/file/__init__.py +0 -0
- {mostlyai-4.0.6 → mostlyai-4.1.0}/mostlyai/sdk/_data/file/base.py +0 -0
- {mostlyai-4.0.6 → mostlyai-4.1.0}/mostlyai/sdk/_data/file/container/__init__.py +0 -0
- {mostlyai-4.0.6 → mostlyai-4.1.0}/mostlyai/sdk/_data/file/container/aws.py +0 -0
- {mostlyai-4.0.6 → mostlyai-4.1.0}/mostlyai/sdk/_data/file/container/bucket_based.py +0 -0
- {mostlyai-4.0.6 → mostlyai-4.1.0}/mostlyai/sdk/_data/file/container/gcs.py +0 -0
- {mostlyai-4.0.6 → mostlyai-4.1.0}/mostlyai/sdk/_data/file/container/minio.py +0 -0
- {mostlyai-4.0.6 → mostlyai-4.1.0}/mostlyai/sdk/_data/file/table/__init__.py +0 -0
- {mostlyai-4.0.6 → mostlyai-4.1.0}/mostlyai/sdk/_data/file/table/csv.py +0 -0
- {mostlyai-4.0.6 → mostlyai-4.1.0}/mostlyai/sdk/_data/file/table/feather.py +0 -0
- {mostlyai-4.0.6 → mostlyai-4.1.0}/mostlyai/sdk/_data/file/table/json.py +0 -0
- {mostlyai-4.0.6 → mostlyai-4.1.0}/mostlyai/sdk/_data/file/table/parquet.py +0 -0
- {mostlyai-4.0.6 → mostlyai-4.1.0}/mostlyai/sdk/_data/file/utils.py +0 -0
- {mostlyai-4.0.6 → mostlyai-4.1.0}/mostlyai/sdk/_data/language_model.py +0 -0
- {mostlyai-4.0.6 → mostlyai-4.1.0}/mostlyai/sdk/_data/metadata_objects.py +0 -0
- {mostlyai-4.0.6 → mostlyai-4.1.0}/mostlyai/sdk/_data/non_context.py +0 -0
- {mostlyai-4.0.6 → mostlyai-4.1.0}/mostlyai/sdk/_data/progress_callback.py +0 -0
- {mostlyai-4.0.6 → mostlyai-4.1.0}/mostlyai/sdk/_data/pull.py +0 -0
- {mostlyai-4.0.6 → mostlyai-4.1.0}/mostlyai/sdk/_data/pull_context.py +0 -0
- {mostlyai-4.0.6 → mostlyai-4.1.0}/mostlyai/sdk/_data/pull_utils.py +0 -0
- {mostlyai-4.0.6 → mostlyai-4.1.0}/mostlyai/sdk/_data/push.py +0 -0
- {mostlyai-4.0.6 → mostlyai-4.1.0}/mostlyai/sdk/_data/util/__init__.py +0 -0
- {mostlyai-4.0.6 → mostlyai-4.1.0}/mostlyai/sdk/_data/util/common.py +0 -0
- {mostlyai-4.0.6 → mostlyai-4.1.0}/mostlyai/sdk/_data/util/kerberos.py +0 -0
- {mostlyai-4.0.6 → mostlyai-4.1.0}/mostlyai/sdk/_local/__init__.py +0 -0
- {mostlyai-4.0.6 → mostlyai-4.1.0}/mostlyai/sdk/_local/cli.py +0 -0
- {mostlyai-4.0.6 → mostlyai-4.1.0}/mostlyai/sdk/_local/connectors.py +0 -0
- {mostlyai-4.0.6 → mostlyai-4.1.0}/mostlyai/sdk/_local/execution/__init__.py +0 -0
- {mostlyai-4.0.6 → mostlyai-4.1.0}/mostlyai/sdk/_local/execution/jobs.py +0 -0
- {mostlyai-4.0.6 → mostlyai-4.1.0}/mostlyai/sdk/_local/execution/plan.py +0 -0
- {mostlyai-4.0.6 → mostlyai-4.1.0}/mostlyai/sdk/_local/execution/step_analyze_training_data.py +0 -0
- {mostlyai-4.0.6 → mostlyai-4.1.0}/mostlyai/sdk/_local/execution/step_create_data_report.py +0 -0
- {mostlyai-4.0.6 → mostlyai-4.1.0}/mostlyai/sdk/_local/execution/step_create_model_report.py +0 -0
- {mostlyai-4.0.6 → mostlyai-4.1.0}/mostlyai/sdk/_local/execution/step_deliver_data.py +0 -0
- {mostlyai-4.0.6 → mostlyai-4.1.0}/mostlyai/sdk/_local/execution/step_encode_training_data.py +0 -0
- {mostlyai-4.0.6 → mostlyai-4.1.0}/mostlyai/sdk/_local/execution/step_finalize_generation.py +0 -0
- {mostlyai-4.0.6 → mostlyai-4.1.0}/mostlyai/sdk/_local/execution/step_finalize_training.py +0 -0
- {mostlyai-4.0.6 → mostlyai-4.1.0}/mostlyai/sdk/_local/execution/step_generate_data.py +0 -0
- {mostlyai-4.0.6 → mostlyai-4.1.0}/mostlyai/sdk/_local/execution/step_generate_model_report_data.py +0 -0
- {mostlyai-4.0.6 → mostlyai-4.1.0}/mostlyai/sdk/_local/execution/step_pull_training_data.py +0 -0
- {mostlyai-4.0.6 → mostlyai-4.1.0}/mostlyai/sdk/_local/execution/step_train_model.py +0 -0
- {mostlyai-4.0.6 → mostlyai-4.1.0}/mostlyai/sdk/_local/generators.py +0 -0
- {mostlyai-4.0.6 → mostlyai-4.1.0}/mostlyai/sdk/_local/progress.py +0 -0
- {mostlyai-4.0.6 → mostlyai-4.1.0}/mostlyai/sdk/_local/routes.py +0 -0
- {mostlyai-4.0.6 → mostlyai-4.1.0}/mostlyai/sdk/_local/server.py +0 -0
- {mostlyai-4.0.6 → mostlyai-4.1.0}/mostlyai/sdk/_local/storage.py +0 -0
- {mostlyai-4.0.6 → mostlyai-4.1.0}/mostlyai/sdk/_local/synthetic_datasets.py +0 -0
- {mostlyai-4.0.6 → mostlyai-4.1.0}/mostlyai/sdk/client/__init__.py +0 -0
- {mostlyai-4.0.6 → mostlyai-4.1.0}/mostlyai/sdk/client/_base_utils.py +0 -0
- {mostlyai-4.0.6 → mostlyai-4.1.0}/mostlyai/sdk/client/_naming_conventions.py +0 -0
- {mostlyai-4.0.6 → mostlyai-4.1.0}/mostlyai/sdk/client/_utils.py +0 -0
- {mostlyai-4.0.6 → mostlyai-4.1.0}/mostlyai/sdk/client/api.py +0 -0
- {mostlyai-4.0.6 → mostlyai-4.1.0}/mostlyai/sdk/client/base.py +0 -0
- {mostlyai-4.0.6 → mostlyai-4.1.0}/mostlyai/sdk/client/connectors.py +0 -0
- {mostlyai-4.0.6 → mostlyai-4.1.0}/mostlyai/sdk/client/exceptions.py +0 -0
- {mostlyai-4.0.6 → mostlyai-4.1.0}/mostlyai/sdk/client/generators.py +0 -0
- {mostlyai-4.0.6 → mostlyai-4.1.0}/mostlyai/sdk/client/synthetic_datasets.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: mostlyai
|
|
3
|
-
Version: 4.0
|
|
3
|
+
Version: 4.1.0
|
|
4
4
|
Summary: Synthetic Data SDK
|
|
5
5
|
Project-URL: homepage, https://app.mostly.ai/
|
|
6
6
|
Project-URL: repository, https://github.com/mostly-ai/mostlyai
|
|
@@ -62,23 +62,23 @@ Requires-Dist: kerberos<2,>=1.3.1; extra == 'hive'
|
|
|
62
62
|
Requires-Dist: pyhive[hive-pure-sasl]<0.8,>=0.7.0; extra == 'hive'
|
|
63
63
|
Provides-Extra: local
|
|
64
64
|
Requires-Dist: fastapi<0.116,>=0.115.6; extra == 'local'
|
|
65
|
-
Requires-Dist: mostlyai-engine==1.0.
|
|
66
|
-
Requires-Dist: mostlyai-qa==1.5.
|
|
65
|
+
Requires-Dist: mostlyai-engine==1.0.4; extra == 'local'
|
|
66
|
+
Requires-Dist: mostlyai-qa==1.5.3; extra == 'local'
|
|
67
67
|
Requires-Dist: python-multipart>=0.0.20; extra == 'local'
|
|
68
68
|
Requires-Dist: torch<2.6.0,>=2.5.1; extra == 'local'
|
|
69
69
|
Requires-Dist: uvicorn<0.35,>=0.34.0; extra == 'local'
|
|
70
70
|
Provides-Extra: local-cpu
|
|
71
71
|
Requires-Dist: fastapi<0.116,>=0.115.6; extra == 'local-cpu'
|
|
72
|
-
Requires-Dist: mostlyai-engine[cpu]==1.0.
|
|
73
|
-
Requires-Dist: mostlyai-qa[cpu]==1.5.
|
|
72
|
+
Requires-Dist: mostlyai-engine[cpu]==1.0.4; extra == 'local-cpu'
|
|
73
|
+
Requires-Dist: mostlyai-qa[cpu]==1.5.3; extra == 'local-cpu'
|
|
74
74
|
Requires-Dist: python-multipart>=0.0.20; extra == 'local-cpu'
|
|
75
75
|
Requires-Dist: torch<2.6.0,>=2.5.1; (sys_platform != 'linux') and extra == 'local-cpu'
|
|
76
76
|
Requires-Dist: torch==2.5.1+cpu; (sys_platform == 'linux') and extra == 'local-cpu'
|
|
77
77
|
Requires-Dist: uvicorn<0.35,>=0.34.0; extra == 'local-cpu'
|
|
78
78
|
Provides-Extra: local-gpu
|
|
79
79
|
Requires-Dist: fastapi<0.116,>=0.115.6; extra == 'local-gpu'
|
|
80
|
-
Requires-Dist: mostlyai-engine[gpu]==1.0.
|
|
81
|
-
Requires-Dist: mostlyai-qa[gpu]==1.5.
|
|
80
|
+
Requires-Dist: mostlyai-engine[gpu]==1.0.4; extra == 'local-gpu'
|
|
81
|
+
Requires-Dist: mostlyai-qa[gpu]==1.5.3; extra == 'local-gpu'
|
|
82
82
|
Requires-Dist: python-multipart>=0.0.20; extra == 'local-gpu'
|
|
83
83
|
Requires-Dist: torch<2.6.0,>=2.5.1; extra == 'local-gpu'
|
|
84
84
|
Requires-Dist: uvicorn<0.35,>=0.34.0; extra == 'local-gpu'
|
|
@@ -76,6 +76,7 @@ class AzureBlobFileContainer(BucketBasedContainer):
|
|
|
76
76
|
self._blob_service_client = BlobServiceClient(
|
|
77
77
|
account_url=f"https://{self.account_name}.blob.core.windows.net",
|
|
78
78
|
credential=credential,
|
|
79
|
+
retry_total=0, # disable retry so that we won't timeout when credentials are incorrect
|
|
79
80
|
)
|
|
80
81
|
|
|
81
82
|
@classmethod
|
|
@@ -96,7 +97,7 @@ class AzureBlobFileContainer(BucketBasedContainer):
|
|
|
96
97
|
|
|
97
98
|
def _check_authenticity(self) -> bool:
|
|
98
99
|
try:
|
|
99
|
-
return self.
|
|
100
|
+
return self._blob_service_client.get_account_information() is not None
|
|
100
101
|
except Exception as e:
|
|
101
102
|
error_message = str(e).lower()
|
|
102
103
|
if any(
|
|
@@ -105,6 +106,8 @@ class AzureBlobFileContainer(BucketBasedContainer):
|
|
|
105
106
|
"cannot connect to host",
|
|
106
107
|
"account is disabled",
|
|
107
108
|
"error on post request",
|
|
109
|
+
"nodename nor servname provided",
|
|
110
|
+
"failed to resolve",
|
|
108
111
|
]
|
|
109
112
|
):
|
|
110
113
|
raise MostlyDataException("Account name is incorrect.")
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
# limitations under the License.
|
|
14
14
|
|
|
15
15
|
# generated by datamodel-codegen:
|
|
16
|
-
# timestamp: 2025-
|
|
16
|
+
# timestamp: 2025-02-05T16:23:28+00:00
|
|
17
17
|
|
|
18
18
|
from __future__ import annotations
|
|
19
19
|
|
|
@@ -839,6 +839,11 @@ class OrganizationListItem(CustomBaseModel):
|
|
|
839
839
|
"""
|
|
840
840
|
|
|
841
841
|
id: str = Field(..., description="The unique identifier of an organization.")
|
|
842
|
+
name: str | None = Field(
|
|
843
|
+
None,
|
|
844
|
+
description="The name of an organization.\nContains only alphanumeric characters, hyphens, and underscores. Must start or end with alphanumeric.\nIt must be globally case-insensitive unique.\n",
|
|
845
|
+
max_length=64,
|
|
846
|
+
)
|
|
842
847
|
display_name: str = Field(..., alias="displayName", description="The display name of an organization.")
|
|
843
848
|
description: str | None = Field(None, description="The description of an organization. Supports markdown.")
|
|
844
849
|
logo: AnyUrl | None = Field(None, description="The URL of the organization's logo.")
|
|
@@ -1601,6 +1606,10 @@ class GeneratorListItem(CustomBaseModel):
|
|
|
1601
1606
|
)
|
|
1602
1607
|
usage: GeneratorUsage | None = None
|
|
1603
1608
|
metadata: Metadata | None = None
|
|
1609
|
+
accuracy: float | None = Field(
|
|
1610
|
+
None,
|
|
1611
|
+
description="The overall accuracy of the trained generator.\nThis is the average of the overall accuracy scores of all trained models.\n",
|
|
1612
|
+
)
|
|
1604
1613
|
OPEN_URL_PARTS: ClassVar[list] = ["d", "generators"]
|
|
1605
1614
|
|
|
1606
1615
|
def __getattr__(self, item):
|
|
@@ -1943,6 +1952,22 @@ class SyntheticTableConfig(CustomBaseModel):
|
|
|
1943
1952
|
values.configuration = SyntheticTableConfiguration()
|
|
1944
1953
|
return values
|
|
1945
1954
|
|
|
1955
|
+
def validate_against_source_table(self, source_table: SourceTable, is_probe: bool) -> None:
|
|
1956
|
+
self._maybe_set_sample_size(source_table, is_probe)
|
|
1957
|
+
_SyntheticTableConfigValidation(synthetic_table=self, source_table=source_table)
|
|
1958
|
+
|
|
1959
|
+
def _maybe_set_sample_size(self, source_table: SourceTable, is_probe: bool) -> None:
|
|
1960
|
+
config = self.configuration
|
|
1961
|
+
is_subject = not any(fk.is_context for fk in source_table.foreign_keys or [])
|
|
1962
|
+
if (
|
|
1963
|
+
not config.sample_size
|
|
1964
|
+
and is_subject
|
|
1965
|
+
and not (config.sample_seed_connector_id or config.sample_seed_dict or config.sample_seed_data)
|
|
1966
|
+
):
|
|
1967
|
+
config.sample_size = 1 if is_probe else source_table.total_rows
|
|
1968
|
+
elif not is_subject:
|
|
1969
|
+
config.sample_size = None
|
|
1970
|
+
|
|
1946
1971
|
|
|
1947
1972
|
class AssistantThreadListItem(CustomBaseModel):
|
|
1948
1973
|
"""
|
|
@@ -2313,7 +2338,7 @@ class SyntheticDatasetConfig(CustomBaseModel):
|
|
|
2313
2338
|
return tables
|
|
2314
2339
|
|
|
2315
2340
|
def validate_against_generator(self, generator: Generator) -> None:
|
|
2316
|
-
|
|
2341
|
+
_SyntheticDataConfigValidation(synthetic_config=self, generator=generator)
|
|
2317
2342
|
|
|
2318
2343
|
|
|
2319
2344
|
class SyntheticProbeConfig(CustomBaseModel):
|
|
@@ -2335,7 +2360,7 @@ class SyntheticProbeConfig(CustomBaseModel):
|
|
|
2335
2360
|
return tables
|
|
2336
2361
|
|
|
2337
2362
|
def validate_against_generator(self, generator: Generator) -> None:
|
|
2338
|
-
|
|
2363
|
+
_SyntheticDataConfigValidation(synthetic_config=self, generator=generator)
|
|
2339
2364
|
|
|
2340
2365
|
|
|
2341
2366
|
class Generator(CustomBaseModel):
|
|
@@ -2811,9 +2836,81 @@ class SyntheticDataset(CustomBaseModel):
|
|
|
2811
2836
|
)
|
|
2812
2837
|
|
|
2813
2838
|
|
|
2814
|
-
class
|
|
2839
|
+
class _SyntheticTableConfigValidation(CustomBaseModel):
|
|
2815
2840
|
"""
|
|
2816
|
-
|
|
2841
|
+
Validation logic for SyntheticTableConfig against SourceTable
|
|
2842
|
+
"""
|
|
2843
|
+
|
|
2844
|
+
synthetic_table: SyntheticTableConfig
|
|
2845
|
+
source_table: SourceTable
|
|
2846
|
+
|
|
2847
|
+
@model_validator(mode="after")
|
|
2848
|
+
def validate_rebalancing_config(cls, validation):
|
|
2849
|
+
config = validation.synthetic_table.configuration
|
|
2850
|
+
if config and config.rebalancing:
|
|
2851
|
+
has_tabular_model = validation.source_table.tabular_model_configuration is not None
|
|
2852
|
+
if not has_tabular_model:
|
|
2853
|
+
raise ValueError(
|
|
2854
|
+
f"Table '{validation.source_table.name}' specifies rebalancing but has no tabular model"
|
|
2855
|
+
)
|
|
2856
|
+
rebalancing_column = config.rebalancing.column
|
|
2857
|
+
rebalancing_col = next(
|
|
2858
|
+
(col for col in validation.source_table.columns or [] if col.name == rebalancing_column), None
|
|
2859
|
+
)
|
|
2860
|
+
if not rebalancing_col:
|
|
2861
|
+
raise ValueError(
|
|
2862
|
+
f"Rebalancing column '{rebalancing_column}' not found in table '{validation.source_table.name}'"
|
|
2863
|
+
)
|
|
2864
|
+
if not rebalancing_col.model_encoding_type == ModelEncodingType.tabular_categorical:
|
|
2865
|
+
raise ValueError(
|
|
2866
|
+
f"Rebalancing column '{rebalancing_column}' in table '{validation.source_table.name}' must be categorical"
|
|
2867
|
+
)
|
|
2868
|
+
for value in config.rebalancing.probabilities.keys():
|
|
2869
|
+
if value not in rebalancing_col.value_range.values:
|
|
2870
|
+
raise ValueError(
|
|
2871
|
+
f"Rebalancing value '{value}' not found in table '{validation.source_table.name}' column '{rebalancing_column}'"
|
|
2872
|
+
)
|
|
2873
|
+
return validation
|
|
2874
|
+
|
|
2875
|
+
@model_validator(mode="after")
|
|
2876
|
+
def validate_imputation_config(cls, validation):
|
|
2877
|
+
config = validation.synthetic_table.configuration
|
|
2878
|
+
if config and config.imputation:
|
|
2879
|
+
has_tabular_model = validation.source_table.tabular_model_configuration is not None
|
|
2880
|
+
if not has_tabular_model:
|
|
2881
|
+
raise ValueError(
|
|
2882
|
+
f"Table '{validation.source_table.name}' specifies imputation but has no tabular model"
|
|
2883
|
+
)
|
|
2884
|
+
for col in config.imputation.columns:
|
|
2885
|
+
if not any(gcol.name == col for gcol in validation.source_table.columns or []):
|
|
2886
|
+
raise ValueError(f"Imputation column '{col}' not found in table '{validation.source_table.name}'")
|
|
2887
|
+
return validation
|
|
2888
|
+
|
|
2889
|
+
@model_validator(mode="after")
|
|
2890
|
+
def validate_fairness_config(cls, validation):
|
|
2891
|
+
config = validation.synthetic_table.configuration
|
|
2892
|
+
if config and config.fairness:
|
|
2893
|
+
has_tabular_model = validation.source_table.tabular_model_configuration is not None
|
|
2894
|
+
if not has_tabular_model:
|
|
2895
|
+
raise ValueError(f"Table '{validation.source_table.name}' specifies fairness but has no tabular model")
|
|
2896
|
+
target_col = config.fairness.target_column
|
|
2897
|
+
if not any(col.name == target_col for col in validation.source_table.columns or []):
|
|
2898
|
+
raise ValueError(
|
|
2899
|
+
f"Fairness target column '{target_col}' not found in table '{validation.source_table.name}'"
|
|
2900
|
+
)
|
|
2901
|
+
for col in config.fairness.sensitive_columns:
|
|
2902
|
+
if not any(gcol.name == col for gcol in validation.source_table.columns or []):
|
|
2903
|
+
raise ValueError(
|
|
2904
|
+
f"Fairness sensitive column '{col}' not found in table '{validation.source_table.name}'"
|
|
2905
|
+
)
|
|
2906
|
+
if target_col in config.fairness.sensitive_columns:
|
|
2907
|
+
raise ValueError(f"Target column '{target_col}' cannot be a sensitive column")
|
|
2908
|
+
return validation
|
|
2909
|
+
|
|
2910
|
+
|
|
2911
|
+
class _SyntheticDataConfigValidation(CustomBaseModel):
|
|
2912
|
+
"""
|
|
2913
|
+
Validation logic for SyntheticDatasetConfig and SyntheticProbeConfig against Generator
|
|
2817
2914
|
"""
|
|
2818
2915
|
|
|
2819
2916
|
synthetic_config: SyntheticDatasetConfig | SyntheticProbeConfig
|
|
@@ -2840,89 +2937,12 @@ class _SyntheticConfigValidation(CustomBaseModel):
|
|
|
2840
2937
|
return validation
|
|
2841
2938
|
|
|
2842
2939
|
@model_validator(mode="after")
|
|
2843
|
-
def
|
|
2844
|
-
generator_table_map = {t.name: t for t in validation.generator.tables}
|
|
2845
|
-
synthetic_table_map = {t.name: t for t in validation.synthetic_config.tables or []}
|
|
2846
|
-
for table_name, synthetic_table in synthetic_table_map.items():
|
|
2847
|
-
generator_table = generator_table_map[table_name]
|
|
2848
|
-
config = synthetic_table.configuration
|
|
2849
|
-
if config and config.rebalancing:
|
|
2850
|
-
has_tabular_model = generator_table.tabular_model_configuration is not None
|
|
2851
|
-
if not has_tabular_model:
|
|
2852
|
-
raise ValueError(f"Table '{table_name}' specifies rebalancing but has no tabular model")
|
|
2853
|
-
rebalancing_column = config.rebalancing.column
|
|
2854
|
-
rebalancing_col = next(
|
|
2855
|
-
(col for col in generator_table.columns or [] if col.name == rebalancing_column), None
|
|
2856
|
-
)
|
|
2857
|
-
if not rebalancing_col:
|
|
2858
|
-
raise ValueError(f"Rebalancing column '{rebalancing_column}' not found in table '{table_name}'")
|
|
2859
|
-
if not rebalancing_col.model_encoding_type == ModelEncodingType.tabular_categorical:
|
|
2860
|
-
raise ValueError(
|
|
2861
|
-
f"Rebalancing column '{rebalancing_column}' in table '{table_name}' must be categorical"
|
|
2862
|
-
)
|
|
2863
|
-
for value in config.rebalancing.probabilities.keys():
|
|
2864
|
-
if value not in rebalancing_col.value_range.values:
|
|
2865
|
-
raise ValueError(
|
|
2866
|
-
f"Rebalancing value '{value}' not found in table '{table_name}' column '{rebalancing_column}'"
|
|
2867
|
-
)
|
|
2868
|
-
return validation
|
|
2869
|
-
|
|
2870
|
-
@model_validator(mode="after")
|
|
2871
|
-
def validate_imputation_configs(cls, validation):
|
|
2872
|
-
generator_table_map = {t.name: t for t in validation.generator.tables}
|
|
2873
|
-
synthetic_table_map = {t.name: t for t in validation.synthetic_config.tables or []}
|
|
2874
|
-
for table_name, synthetic_table in synthetic_table_map.items():
|
|
2875
|
-
generator_table = generator_table_map[table_name]
|
|
2876
|
-
config = synthetic_table.configuration
|
|
2877
|
-
if config and config.imputation:
|
|
2878
|
-
has_tabular_model = generator_table.tabular_model_configuration is not None
|
|
2879
|
-
if not has_tabular_model:
|
|
2880
|
-
raise ValueError(f"Table '{table_name}' specifies imputation but has no tabular model")
|
|
2881
|
-
for col in config.imputation.columns:
|
|
2882
|
-
if not any(gcol.name == col for gcol in generator_table.columns or []):
|
|
2883
|
-
raise ValueError(f"Imputation column '{col}' not found in table '{table_name}'")
|
|
2884
|
-
return validation
|
|
2885
|
-
|
|
2886
|
-
@model_validator(mode="after")
|
|
2887
|
-
def validate_fairness_configs(cls, validation):
|
|
2940
|
+
def validate_tables(cls, validation):
|
|
2888
2941
|
generator_table_map = {t.name: t for t in validation.generator.tables}
|
|
2889
2942
|
synthetic_table_map = {t.name: t for t in validation.synthetic_config.tables or []}
|
|
2890
2943
|
for table_name, synthetic_table in synthetic_table_map.items():
|
|
2891
2944
|
generator_table = generator_table_map[table_name]
|
|
2892
|
-
|
|
2893
|
-
|
|
2894
|
-
|
|
2895
|
-
if not has_tabular_model:
|
|
2896
|
-
raise ValueError(f"Table '{table_name}' specifies fairness but has no tabular model")
|
|
2897
|
-
target_col = config.fairness.target_column
|
|
2898
|
-
if not any(col.name == target_col for col in generator_table.columns or []):
|
|
2899
|
-
raise ValueError(f"Fairness target column '{target_col}' not found in table '{table_name}'")
|
|
2900
|
-
for col in config.fairness.sensitive_columns:
|
|
2901
|
-
if not any(gcol.name == col for gcol in generator_table.columns or []):
|
|
2902
|
-
raise ValueError(f"Fairness sensitive column '{col}' not found in table '{table_name}'")
|
|
2903
|
-
if target_col in config.fairness.sensitive_columns:
|
|
2904
|
-
raise ValueError(f"Target column '{target_col}' cannot be a sensitive column")
|
|
2905
|
-
return validation
|
|
2906
|
-
|
|
2907
|
-
@model_validator(mode="after")
|
|
2908
|
-
def set_default_sample_sizes(cls, validation):
|
|
2909
|
-
generator_table_map = {t.name: t for t in validation.generator.tables}
|
|
2910
|
-
synthetic_table_map = {t.name: t for t in validation.synthetic_config.tables or []}
|
|
2911
|
-
for table_name, synthetic_table in synthetic_table_map.items():
|
|
2912
|
-
generator_table = generator_table_map[table_name]
|
|
2913
|
-
config = synthetic_table.configuration
|
|
2914
|
-
if config:
|
|
2915
|
-
is_subject = not any(fk.is_context for fk in generator_table.foreign_keys or [])
|
|
2916
|
-
if (
|
|
2917
|
-
not config.sample_size
|
|
2918
|
-
and is_subject
|
|
2919
|
-
and (not (config.sample_seed_connector_id or config.sample_seed_dict or config.sample_seed_data))
|
|
2920
|
-
):
|
|
2921
|
-
config.sample_size = (
|
|
2922
|
-
1
|
|
2923
|
-
if isinstance(validation.synthetic_config, SyntheticProbeConfig)
|
|
2924
|
-
else generator_table.total_rows
|
|
2925
|
-
)
|
|
2926
|
-
elif not is_subject:
|
|
2927
|
-
config.sample_size = None
|
|
2945
|
+
synthetic_table.validate_against_source_table(
|
|
2946
|
+
generator_table, is_probe=isinstance(validation.synthetic_config, SyntheticProbeConfig)
|
|
2947
|
+
)
|
|
2928
2948
|
return validation
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "mostlyai"
|
|
3
|
-
version = "4.0
|
|
3
|
+
version = "4.1.0"
|
|
4
4
|
description = "Synthetic Data SDK"
|
|
5
5
|
authors = [{ name = "MOSTLY AI", email = "dev@mostly.ai" }]
|
|
6
6
|
requires-python = ">=3.10,<3.14"
|
|
@@ -58,24 +58,24 @@ dependencies = [
|
|
|
58
58
|
[project.optional-dependencies]
|
|
59
59
|
local = [
|
|
60
60
|
# local
|
|
61
|
-
"mostlyai-engine==1.0.
|
|
62
|
-
"mostlyai-qa==1.5.
|
|
61
|
+
"mostlyai-engine==1.0.4",
|
|
62
|
+
"mostlyai-qa==1.5.3",
|
|
63
63
|
"fastapi>=0.115.6,<0.116",
|
|
64
64
|
"uvicorn>=0.34.0,<0.35",
|
|
65
65
|
"python-multipart>=0.0.20",
|
|
66
66
|
"torch>=2.5.1,<2.6.0",
|
|
67
67
|
]
|
|
68
68
|
local-gpu = [
|
|
69
|
-
"mostlyai-engine[gpu]==1.0.
|
|
70
|
-
"mostlyai-qa[gpu]==1.5.
|
|
69
|
+
"mostlyai-engine[gpu]==1.0.4",
|
|
70
|
+
"mostlyai-qa[gpu]==1.5.3",
|
|
71
71
|
"fastapi>=0.115.6,<0.116",
|
|
72
72
|
"uvicorn>=0.34.0,<0.35",
|
|
73
73
|
"python-multipart>=0.0.20",
|
|
74
74
|
"torch>=2.5.1,<2.6.0",
|
|
75
75
|
]
|
|
76
76
|
local-cpu = [
|
|
77
|
-
"mostlyai-engine[cpu]==1.0.
|
|
78
|
-
"mostlyai-qa[cpu]==1.5.
|
|
77
|
+
"mostlyai-engine[cpu]==1.0.4",
|
|
78
|
+
"mostlyai-qa[cpu]==1.5.3",
|
|
79
79
|
"fastapi>=0.115.6,<0.116",
|
|
80
80
|
"uvicorn>=0.34.0,<0.35",
|
|
81
81
|
"python-multipart>=0.0.20",
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{mostlyai-4.0.6 → mostlyai-4.1.0}/mostlyai/sdk/_local/execution/step_analyze_training_data.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{mostlyai-4.0.6 → mostlyai-4.1.0}/mostlyai/sdk/_local/execution/step_encode_training_data.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{mostlyai-4.0.6 → mostlyai-4.1.0}/mostlyai/sdk/_local/execution/step_generate_model_report_data.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|