mostlyai 4.5.7__tar.gz → 4.6.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.
Files changed (86) hide show
  1. {mostlyai-4.5.7 → mostlyai-4.6.0}/PKG-INFO +5 -5
  2. {mostlyai-4.5.7 → mostlyai-4.6.0}/mostlyai/sdk/__init__.py +1 -1
  3. mostlyai-4.6.0/mostlyai/sdk/_local/execution/migration.py +32 -0
  4. {mostlyai-4.5.7 → mostlyai-4.6.0}/mostlyai/sdk/_local/execution/step_analyze_training_data.py +9 -0
  5. {mostlyai-4.5.7 → mostlyai-4.6.0}/mostlyai/sdk/_local/execution/step_create_model_report.py +0 -1
  6. {mostlyai-4.5.7 → mostlyai-4.6.0}/mostlyai/sdk/_local/execution/step_encode_training_data.py +5 -0
  7. {mostlyai-4.5.7 → mostlyai-4.6.0}/mostlyai/sdk/_local/execution/step_generate_data.py +4 -0
  8. {mostlyai-4.5.7 → mostlyai-4.6.0}/mostlyai/sdk/domain.py +50 -18
  9. {mostlyai-4.5.7 → mostlyai-4.6.0}/pyproject.toml +5 -5
  10. {mostlyai-4.5.7 → mostlyai-4.6.0}/.gitignore +0 -0
  11. {mostlyai-4.5.7 → mostlyai-4.6.0}/LICENSE +0 -0
  12. {mostlyai-4.5.7 → mostlyai-4.6.0}/README.md +0 -0
  13. {mostlyai-4.5.7 → mostlyai-4.6.0}/mostlyai/sdk/_data/__init__.py +0 -0
  14. {mostlyai-4.5.7 → mostlyai-4.6.0}/mostlyai/sdk/_data/auto_detect.py +0 -0
  15. {mostlyai-4.5.7 → mostlyai-4.6.0}/mostlyai/sdk/_data/base.py +0 -0
  16. {mostlyai-4.5.7 → mostlyai-4.6.0}/mostlyai/sdk/_data/context.py +0 -0
  17. {mostlyai-4.5.7 → mostlyai-4.6.0}/mostlyai/sdk/_data/conversions.py +0 -0
  18. {mostlyai-4.5.7 → mostlyai-4.6.0}/mostlyai/sdk/_data/db/__init__.py +0 -0
  19. {mostlyai-4.5.7 → mostlyai-4.6.0}/mostlyai/sdk/_data/db/base.py +0 -0
  20. {mostlyai-4.5.7 → mostlyai-4.6.0}/mostlyai/sdk/_data/db/bigquery.py +0 -0
  21. {mostlyai-4.5.7 → mostlyai-4.6.0}/mostlyai/sdk/_data/db/databricks.py +0 -0
  22. {mostlyai-4.5.7 → mostlyai-4.6.0}/mostlyai/sdk/_data/db/hive.py +0 -0
  23. {mostlyai-4.5.7 → mostlyai-4.6.0}/mostlyai/sdk/_data/db/mssql.py +0 -0
  24. {mostlyai-4.5.7 → mostlyai-4.6.0}/mostlyai/sdk/_data/db/mysql.py +0 -0
  25. {mostlyai-4.5.7 → mostlyai-4.6.0}/mostlyai/sdk/_data/db/oracle.py +0 -0
  26. {mostlyai-4.5.7 → mostlyai-4.6.0}/mostlyai/sdk/_data/db/postgresql.py +0 -0
  27. {mostlyai-4.5.7 → mostlyai-4.6.0}/mostlyai/sdk/_data/db/snowflake.py +0 -0
  28. {mostlyai-4.5.7 → mostlyai-4.6.0}/mostlyai/sdk/_data/db/sqlite.py +0 -0
  29. {mostlyai-4.5.7 → mostlyai-4.6.0}/mostlyai/sdk/_data/db/types_coercion.py +0 -0
  30. {mostlyai-4.5.7 → mostlyai-4.6.0}/mostlyai/sdk/_data/dtype.py +0 -0
  31. {mostlyai-4.5.7 → mostlyai-4.6.0}/mostlyai/sdk/_data/exceptions.py +0 -0
  32. {mostlyai-4.5.7 → mostlyai-4.6.0}/mostlyai/sdk/_data/file/__init__.py +0 -0
  33. {mostlyai-4.5.7 → mostlyai-4.6.0}/mostlyai/sdk/_data/file/base.py +0 -0
  34. {mostlyai-4.5.7 → mostlyai-4.6.0}/mostlyai/sdk/_data/file/container/__init__.py +0 -0
  35. {mostlyai-4.5.7 → mostlyai-4.6.0}/mostlyai/sdk/_data/file/container/aws.py +0 -0
  36. {mostlyai-4.5.7 → mostlyai-4.6.0}/mostlyai/sdk/_data/file/container/azure.py +0 -0
  37. {mostlyai-4.5.7 → mostlyai-4.6.0}/mostlyai/sdk/_data/file/container/bucket_based.py +0 -0
  38. {mostlyai-4.5.7 → mostlyai-4.6.0}/mostlyai/sdk/_data/file/container/gcs.py +0 -0
  39. {mostlyai-4.5.7 → mostlyai-4.6.0}/mostlyai/sdk/_data/file/container/minio.py +0 -0
  40. {mostlyai-4.5.7 → mostlyai-4.6.0}/mostlyai/sdk/_data/file/table/__init__.py +0 -0
  41. {mostlyai-4.5.7 → mostlyai-4.6.0}/mostlyai/sdk/_data/file/table/csv.py +0 -0
  42. {mostlyai-4.5.7 → mostlyai-4.6.0}/mostlyai/sdk/_data/file/table/feather.py +0 -0
  43. {mostlyai-4.5.7 → mostlyai-4.6.0}/mostlyai/sdk/_data/file/table/json.py +0 -0
  44. {mostlyai-4.5.7 → mostlyai-4.6.0}/mostlyai/sdk/_data/file/table/parquet.py +0 -0
  45. {mostlyai-4.5.7 → mostlyai-4.6.0}/mostlyai/sdk/_data/file/utils.py +0 -0
  46. {mostlyai-4.5.7 → mostlyai-4.6.0}/mostlyai/sdk/_data/language_model.py +0 -0
  47. {mostlyai-4.5.7 → mostlyai-4.6.0}/mostlyai/sdk/_data/metadata_objects.py +0 -0
  48. {mostlyai-4.5.7 → mostlyai-4.6.0}/mostlyai/sdk/_data/non_context.py +0 -0
  49. {mostlyai-4.5.7 → mostlyai-4.6.0}/mostlyai/sdk/_data/progress_callback.py +0 -0
  50. {mostlyai-4.5.7 → mostlyai-4.6.0}/mostlyai/sdk/_data/pull.py +0 -0
  51. {mostlyai-4.5.7 → mostlyai-4.6.0}/mostlyai/sdk/_data/pull_context.py +0 -0
  52. {mostlyai-4.5.7 → mostlyai-4.6.0}/mostlyai/sdk/_data/pull_utils.py +0 -0
  53. {mostlyai-4.5.7 → mostlyai-4.6.0}/mostlyai/sdk/_data/push.py +0 -0
  54. {mostlyai-4.5.7 → mostlyai-4.6.0}/mostlyai/sdk/_data/util/__init__.py +0 -0
  55. {mostlyai-4.5.7 → mostlyai-4.6.0}/mostlyai/sdk/_data/util/common.py +0 -0
  56. {mostlyai-4.5.7 → mostlyai-4.6.0}/mostlyai/sdk/_data/util/kerberos.py +0 -0
  57. {mostlyai-4.5.7 → mostlyai-4.6.0}/mostlyai/sdk/_local/__init__.py +0 -0
  58. {mostlyai-4.5.7 → mostlyai-4.6.0}/mostlyai/sdk/_local/cli.py +0 -0
  59. {mostlyai-4.5.7 → mostlyai-4.6.0}/mostlyai/sdk/_local/connectors.py +0 -0
  60. {mostlyai-4.5.7 → mostlyai-4.6.0}/mostlyai/sdk/_local/execution/__init__.py +0 -0
  61. {mostlyai-4.5.7 → mostlyai-4.6.0}/mostlyai/sdk/_local/execution/jobs.py +0 -0
  62. {mostlyai-4.5.7 → mostlyai-4.6.0}/mostlyai/sdk/_local/execution/plan.py +0 -0
  63. {mostlyai-4.5.7 → mostlyai-4.6.0}/mostlyai/sdk/_local/execution/step_create_data_report.py +0 -0
  64. {mostlyai-4.5.7 → mostlyai-4.6.0}/mostlyai/sdk/_local/execution/step_deliver_data.py +0 -0
  65. {mostlyai-4.5.7 → mostlyai-4.6.0}/mostlyai/sdk/_local/execution/step_finalize_generation.py +0 -0
  66. {mostlyai-4.5.7 → mostlyai-4.6.0}/mostlyai/sdk/_local/execution/step_finalize_training.py +0 -0
  67. {mostlyai-4.5.7 → mostlyai-4.6.0}/mostlyai/sdk/_local/execution/step_generate_model_report_data.py +0 -0
  68. {mostlyai-4.5.7 → mostlyai-4.6.0}/mostlyai/sdk/_local/execution/step_pull_training_data.py +0 -0
  69. {mostlyai-4.5.7 → mostlyai-4.6.0}/mostlyai/sdk/_local/execution/step_train_model.py +1 -1
  70. {mostlyai-4.5.7 → mostlyai-4.6.0}/mostlyai/sdk/_local/generators.py +0 -0
  71. {mostlyai-4.5.7 → mostlyai-4.6.0}/mostlyai/sdk/_local/progress.py +0 -0
  72. {mostlyai-4.5.7 → mostlyai-4.6.0}/mostlyai/sdk/_local/routes.py +0 -0
  73. {mostlyai-4.5.7 → mostlyai-4.6.0}/mostlyai/sdk/_local/server.py +0 -0
  74. {mostlyai-4.5.7 → mostlyai-4.6.0}/mostlyai/sdk/_local/storage.py +0 -0
  75. {mostlyai-4.5.7 → mostlyai-4.6.0}/mostlyai/sdk/_local/synthetic_datasets.py +0 -0
  76. {mostlyai-4.5.7 → mostlyai-4.6.0}/mostlyai/sdk/client/__init__.py +0 -0
  77. {mostlyai-4.5.7 → mostlyai-4.6.0}/mostlyai/sdk/client/_base_utils.py +0 -0
  78. {mostlyai-4.5.7 → mostlyai-4.6.0}/mostlyai/sdk/client/_naming_conventions.py +0 -0
  79. {mostlyai-4.5.7 → mostlyai-4.6.0}/mostlyai/sdk/client/_utils.py +0 -0
  80. {mostlyai-4.5.7 → mostlyai-4.6.0}/mostlyai/sdk/client/api.py +0 -0
  81. {mostlyai-4.5.7 → mostlyai-4.6.0}/mostlyai/sdk/client/base.py +0 -0
  82. {mostlyai-4.5.7 → mostlyai-4.6.0}/mostlyai/sdk/client/connectors.py +0 -0
  83. {mostlyai-4.5.7 → mostlyai-4.6.0}/mostlyai/sdk/client/exceptions.py +0 -0
  84. {mostlyai-4.5.7 → mostlyai-4.6.0}/mostlyai/sdk/client/generators.py +0 -0
  85. {mostlyai-4.5.7 → mostlyai-4.6.0}/mostlyai/sdk/client/synthetic_datasets.py +0 -0
  86. {mostlyai-4.5.7 → mostlyai-4.6.0}/mostlyai/sdk/py.typed +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mostlyai
3
- Version: 4.5.7
3
+ Version: 4.6.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
@@ -59,8 +59,8 @@ Requires-Dist: fastapi<0.116,>=0.115.6; extra == 'local'
59
59
  Requires-Dist: filelock>=3.16.1; extra == 'local'
60
60
  Requires-Dist: gcsfs>=2023.1.0; extra == 'local'
61
61
  Requires-Dist: joblib>=1.4.2; extra == 'local'
62
- Requires-Dist: mostlyai-engine==1.3.3; extra == 'local'
63
- Requires-Dist: mostlyai-qa==1.7.0; extra == 'local'
62
+ Requires-Dist: mostlyai-engine==1.4.0; extra == 'local'
63
+ Requires-Dist: mostlyai-qa==1.9.1; extra == 'local'
64
64
  Requires-Dist: networkx<4,>=3.0; extra == 'local'
65
65
  Requires-Dist: openpyxl>=3.1.5; extra == 'local'
66
66
  Requires-Dist: python-multipart>=0.0.20; extra == 'local'
@@ -81,8 +81,8 @@ Requires-Dist: fastapi<0.116,>=0.115.6; extra == 'local-gpu'
81
81
  Requires-Dist: filelock>=3.16.1; extra == 'local-gpu'
82
82
  Requires-Dist: gcsfs>=2023.1.0; extra == 'local-gpu'
83
83
  Requires-Dist: joblib>=1.4.2; extra == 'local-gpu'
84
- Requires-Dist: mostlyai-engine[gpu]==1.3.3; extra == 'local-gpu'
85
- Requires-Dist: mostlyai-qa==1.7.0; extra == 'local-gpu'
84
+ Requires-Dist: mostlyai-engine[gpu]==1.4.0; extra == 'local-gpu'
85
+ Requires-Dist: mostlyai-qa==1.9.1; extra == 'local-gpu'
86
86
  Requires-Dist: networkx<4,>=3.0; extra == 'local-gpu'
87
87
  Requires-Dist: openpyxl>=3.1.5; extra == 'local-gpu'
88
88
  Requires-Dist: python-multipart>=0.0.20; extra == 'local-gpu'
@@ -15,4 +15,4 @@
15
15
  from mostlyai.sdk.client.api import MostlyAI
16
16
 
17
17
  __all__ = ["MostlyAI"]
18
- __version__ = "4.5.7" # Do not set this manually. Use poetry version [params].
18
+ __version__ = "4.6.0" # Do not set this manually. Use poetry version [params].
@@ -0,0 +1,32 @@
1
+ # Copyright 2025 MOSTLY AI
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ from pathlib import Path
16
+ from mostlyai.engine._workspace import Workspace
17
+
18
+
19
+ def migrate_workspace(workspace_dir: Path) -> None:
20
+ workspace = Workspace(workspace_dir)
21
+ # migrate min5/max5 in column stats to min/max (<= 4.5.6)
22
+ for stats_pathdesc in [workspace.ctx_stats, workspace.tgt_stats]:
23
+ stats = stats_pathdesc.read()
24
+ if stats:
25
+ for col, col_stats in stats.get("columns", {}).items():
26
+ if col_stats.get("min5") is not None:
27
+ col_stats["min"] = min(col_stats["min5"]) if len(col_stats["min5"]) > 0 else None
28
+ col_stats.pop("min5")
29
+ if col_stats.get("max5") is not None:
30
+ col_stats["max"] = max(col_stats["max5"]) if len(col_stats["max5"]) > 0 else None
31
+ col_stats.pop("max5")
32
+ stats_pathdesc.write(stats)
@@ -17,6 +17,8 @@ from collections import ChainMap, defaultdict
17
17
  from pathlib import Path
18
18
  from collections.abc import Callable
19
19
 
20
+ from mostlyai.engine.domain import DifferentialPrivacyConfig
21
+
20
22
  from mostlyai.sdk.domain import Generator, ModelType, SourceColumnValueRange, ModelEncodingType
21
23
 
22
24
 
@@ -39,10 +41,17 @@ def execute_step_analyze_training_data(
39
41
  else:
40
42
  model_config = tgt_table.tabular_model_configuration
41
43
 
44
+ # convert from SDK domain to ENGINE domain
45
+ if model_config.differential_privacy:
46
+ differential_privacy = DifferentialPrivacyConfig(**model_config.differential_privacy.model_dump())
47
+ else:
48
+ differential_privacy = None
49
+
42
50
  # call ANALYZE
43
51
  engine.analyze(
44
52
  workspace_dir=workspace_dir,
45
53
  value_protection=model_config.value_protection,
54
+ differential_privacy=differential_privacy,
46
55
  update_progress=update_progress,
47
56
  )
48
57
 
@@ -209,7 +209,6 @@ def create_report(
209
209
  report_subtitle=f" for {target_table_name[:30]}:{model_type.name}",
210
210
  report_credits=report_credits,
211
211
  max_sample_size_accuracy=100_000,
212
- max_sample_size_embeddings=10_000,
213
212
  update_progress=update_progress,
214
213
  )
215
214
  metrics = None
@@ -16,6 +16,8 @@
16
16
  from pathlib import Path
17
17
  from collections.abc import Callable
18
18
 
19
+ from mostlyai.sdk._local.execution.migration import migrate_workspace
20
+
19
21
 
20
22
  def execute_step_encode_training_data(
21
23
  *,
@@ -25,6 +27,9 @@ def execute_step_encode_training_data(
25
27
  # import ENGINE here to avoid pre-mature loading of large ENGINE dependencies
26
28
  from mostlyai import engine
27
29
 
30
+ # ensure backward compatibility
31
+ migrate_workspace(workspace_dir)
32
+
28
33
  # call ENCODE
29
34
  engine.encode(
30
35
  workspace_dir=workspace_dir,
@@ -20,6 +20,7 @@ import pandas as pd
20
20
  from mostlyai.sdk import _data as data
21
21
  from mostlyai.sdk._data.base import Schema
22
22
  from mostlyai.sdk._data.util.common import TABLE_COLUMN_INFIX, TEMPORARY_PRIMARY_KEY
23
+ from mostlyai.sdk._local.execution.migration import migrate_workspace
23
24
  from mostlyai.sdk.domain import Generator, SyntheticDataset, ModelType
24
25
 
25
26
 
@@ -37,6 +38,9 @@ def execute_step_generate_data(
37
38
  # import ENGINE here to avoid pre-mature loading of large ENGINE dependencies
38
39
  import mostlyai.engine as engine
39
40
 
41
+ # ensure backward compatibility
42
+ migrate_workspace(workspace_dir)
43
+
40
44
  tgt_g_table = next(t for t in generator.tables if t.name == target_table_name)
41
45
  tgt_sd_table = next(t for t in synthetic_dataset.tables if t.name == target_table_name)
42
46
  config = tgt_sd_table.configuration
@@ -13,7 +13,7 @@
13
13
  # limitations under the License.
14
14
 
15
15
  # generated by datamodel-codegen:
16
- # timestamp: 2025-04-22T09:42:59+00:00
16
+ # timestamp: 2025-05-11T00:16:17+00:00
17
17
 
18
18
  from __future__ import annotations
19
19
 
@@ -1400,31 +1400,38 @@ class DifferentialPrivacyConfig(CustomBaseModel):
1400
1400
  """
1401
1401
 
1402
1402
  max_epsilon: float | None = Field(
1403
- None,
1403
+ 10.0,
1404
1404
  alias="maxEpsilon",
1405
1405
  description="Specifies the maximum allowable epsilon value. If the training process exceeds this threshold, it will be terminated early. Only model checkpoints with epsilon values below this limit will be retained. \nIf not provided, the training will proceed without early termination based on epsilon constraints.\n",
1406
- ge=0.0,
1406
+ gt=0.0,
1407
1407
  le=10000.0,
1408
1408
  )
1409
+ delta: float | None = Field(
1410
+ "1e-5",
1411
+ description="The delta value for differential privacy. It is the probability of the privacy guarantee not holding. \nThe smaller the delta, the more confident you can be that the privacy guarantee holds.\nThis delta will be equally distributed between the analysis and the training phase.\n",
1412
+ gt=0.0,
1413
+ le=1.0,
1414
+ )
1409
1415
  noise_multiplier: float | None = Field(
1410
1416
  1.5,
1411
1417
  alias="noiseMultiplier",
1412
- description="The ratio of the standard deviation of the Gaussian noise to the L2-sensitivity of the function to which the noise is added (How much noise to add).\n",
1418
+ description="Determines how much noise while training the model with differential privacy. This is the ratio of the standard deviation of the Gaussian noise to the L2-sensitivity of the function to which the noise is added.\n",
1413
1419
  ge=0.0,
1414
1420
  le=10000.0,
1415
1421
  )
1416
1422
  max_grad_norm: float | None = Field(
1417
1423
  1.0,
1418
1424
  alias="maxGradNorm",
1419
- description="The maximum norm of the per-sample gradients for training the model with differential privacy.\n",
1425
+ description="Determines the maximum impact of a single sample on updating the model weights during training with differential privacy. This is the maximum norm of the per-sample gradients.\n",
1420
1426
  ge=0.0,
1421
1427
  le=10000.0,
1422
1428
  )
1423
- delta: float | None = Field(
1424
- "1e-5",
1425
- description="The delta value for differential privacy. It is the probability of the privacy guarantee not holding. \nThe smaller the delta, the more confident you can be that the privacy guarantee holds.\n",
1426
- ge=0.0,
1427
- le=1.0,
1429
+ value_protection_epsilon: float | None = Field(
1430
+ 1.0,
1431
+ alias="valueProtectionEpsilon",
1432
+ description="The DP epsilon of the privacy budget for determining the value ranges, which are gathered prior to the model training during the analysis step. Only applicable if value protection is True.\nPrivacy budget will be equally distributed between the columns. For categorical we calculate noisy histograms and use a noisy threshold. For numeric and datetime we calculate bounds based on noisy histograms.\n",
1433
+ gt=0.0,
1434
+ le=10000.0,
1428
1435
  )
1429
1436
 
1430
1437
 
@@ -1436,7 +1443,8 @@ class Accuracy(CustomBaseModel):
1436
1443
  1. **Univariate Accuracy**: The accuracy of the univariate distributions for all target columns.
1437
1444
  2. **Bivariate Accuracy**: The accuracy of all pair-wise distributions for target columns, as well as for target
1438
1445
  columns with respect to the context columns.
1439
- 3. **Coherence Accuracy**: The accuracy of the auto-correlation for all target columns.
1446
+ 3. **Trivariate Accuracy**: The accuracy of all three-way distributions for target columns.
1447
+ 4. **Coherence Accuracy**: The accuracy of the auto-correlation for all target columns.
1440
1448
 
1441
1449
  Accuracy is defined as 100% - [Total Variation Distance](https://en.wikipedia.org/wiki/Total_variation_distance_of_probability_measures) (TVD),
1442
1450
  whereas TVD is half the sum of the absolute differences of the relative frequencies of the corresponding
@@ -1470,6 +1478,12 @@ class Accuracy(CustomBaseModel):
1470
1478
  ge=0.0,
1471
1479
  le=1.0,
1472
1480
  )
1481
+ trivariate: float | None = Field(
1482
+ None,
1483
+ description="Average accuracy of discretized trivariate distributions.\n",
1484
+ ge=0.0,
1485
+ le=1.0,
1486
+ )
1473
1487
  coherence: float | None = Field(
1474
1488
  None,
1475
1489
  description="Average accuracy of discretized coherence distributions. Only applicable for sequential data.\n",
@@ -1497,6 +1511,13 @@ class Accuracy(CustomBaseModel):
1497
1511
  ge=0.0,
1498
1512
  le=1.0,
1499
1513
  )
1514
+ trivariate_max: float | None = Field(
1515
+ None,
1516
+ alias="trivariateMax",
1517
+ description="Expected trivariate accuracy of a same-sized holdout. Serves as a reference for `trivariate`.\n",
1518
+ ge=0.0,
1519
+ le=1.0,
1520
+ )
1500
1521
  coherence_max: float | None = Field(
1501
1522
  None,
1502
1523
  alias="coherenceMax",
@@ -1560,19 +1581,19 @@ class Similarity(CustomBaseModel):
1560
1581
 
1561
1582
  class Distances(CustomBaseModel):
1562
1583
  """
1563
- Metrics regarding the nearest neighbor distances between training, holdout, and synthetic samples in an embedding
1564
- space. Useful for assessing the novelty / privacy of synthetic data.
1584
+ Metrics regarding the nearest neighbor distances between training, holdout, and synthetic samples in an numerically
1585
+ encoded space. Useful for assessing the novelty / privacy of synthetic data.
1565
1586
 
1566
1587
  The provided data is first down-sampled, so that the number of samples match across all datasets. Note, that for
1567
1588
  an optimal sensitivity of this privacy assessment it is recommended to use a 50/50 split between training and
1568
1589
  holdout data, and then generate synthetic data of the same size.
1569
1590
 
1570
- The embeddings of these samples are then computed, and the nearest neighbor distances are calculated for each
1591
+ The numerical encodings of these samples are then computed, and the nearest neighbor distances are calculated for each
1571
1592
  synthetic sample to the training and holdout samples. Based on these nearest neighbor distances the following
1572
1593
  metrics are calculated:
1573
- - Identical Match Share (IMS): The share of synthetic samples that are identical to a training or holdout sample.
1574
- - Distance to Closest Record (DCR): The average distance of synthetic to training or holdout samples.
1575
- - Nearest Neighbor Distance Ratio (NNDR): The 10-th smallest ratio of the distance to nearest and second nearest neighbor.
1594
+ - Identical Match Share (IMS): The share of synthetic samples that are identical to a training or holdout sample.
1595
+ - Distance to Closest Record (DCR): The average distance of synthetic to training or holdout samples.
1596
+ - Nearest Neighbor Distance Ratio (NNDR): The 10-th smallest ratio of the distance to nearest and second nearest neighbor.
1576
1597
 
1577
1598
  For privacy-safe synthetic data we expect to see about as many identical matches, and about the same distances
1578
1599
  for synthetic samples to training, as we see for synthetic samples to holdout.
@@ -2186,6 +2207,17 @@ class ModelConfiguration(CustomBaseModel):
2186
2207
  description="If false, then the Model report is not generated.\n",
2187
2208
  )
2188
2209
 
2210
+ @model_validator(mode="after")
2211
+ @classmethod
2212
+ def validate_differential_privacy_config(cls, values):
2213
+ if values.differential_privacy:
2214
+ if not values.value_protection:
2215
+ values.differential_privacy.value_protection_epsilon = None
2216
+ else:
2217
+ if values.differential_privacy.value_protection_epsilon is None:
2218
+ values.differential_privacy.value_protection_epsilon = 1.0
2219
+ return values
2220
+
2189
2221
 
2190
2222
  class ProgressStep(CustomBaseModel):
2191
2223
  """
@@ -2477,7 +2509,7 @@ class ModelMetrics(CustomBaseModel):
2477
2509
  2. **Similarity**: Metrics regarding the similarity of the full joint distributions of samples within an embedding
2478
2510
  space.
2479
2511
  3. **Distances**: Metrics regarding the nearest neighbor distances between training, holdout, and synthetic samples
2480
- in an embedding space. Useful for assessing the novelty / privacy of synthetic data.
2512
+ in an numeric encoding space. Useful for assessing the novelty / privacy of synthetic data.
2481
2513
 
2482
2514
  The quality of synthetic data is assessed by comparing these metrics to the same metrics of a holdout dataset.
2483
2515
  The holdout dataset is a subset of the original training data, that was not used for training the synthetic data
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "mostlyai"
3
- version = "4.5.7"
3
+ version = "4.6.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"
@@ -49,8 +49,8 @@ dependencies = [
49
49
  local = [
50
50
  # "mostlyai-engine @ git+https://github.com/mostly-ai/mostlyai-engine.git@main", # for development
51
51
  # "mostlyai-qa @ git+https://github.com/mostly-ai/mostlyai-qa.git@main", # for development
52
- "mostlyai-engine==1.3.3", # for release
53
- "mostlyai-qa==1.7.0", # for release
52
+ "mostlyai-engine==1.4.0", # for release
53
+ "mostlyai-qa==1.9.1", # for release
54
54
  "fastapi>=0.115.6,<0.116",
55
55
  "uvicorn>=0.34.0,<0.35",
56
56
  "python-multipart>=0.0.20",
@@ -75,8 +75,8 @@ local = [
75
75
  local-gpu = [
76
76
  # "mostlyai-engine[gpu] @ git+https://github.com/mostly-ai/mostlyai-engine.git@main", # for development
77
77
  # "mostlyai-qa @ git+https://github.com/mostly-ai/mostlyai-qa.git@main", # for development
78
- "mostlyai-engine[gpu]==1.3.3", # for release
79
- "mostlyai-qa==1.7.0", # for release
78
+ "mostlyai-engine[gpu]==1.4.0", # for release
79
+ "mostlyai-qa==1.9.1", # for release
80
80
  "fastapi>=0.115.6,<0.116",
81
81
  "uvicorn>=0.34.0,<0.35",
82
82
  "python-multipart>=0.0.20",
File without changes
File without changes
File without changes
@@ -62,8 +62,8 @@ def execute_step_train_model(
62
62
  max_epochs=model_config.max_epochs,
63
63
  batch_size=model_config.batch_size,
64
64
  gradient_accumulation_steps=model_config.gradient_accumulation_steps,
65
- max_sequence_window=max_sequence_window,
66
65
  enable_flexible_generation=model_config.enable_flexible_generation,
66
+ max_sequence_window=max_sequence_window,
67
67
  differential_privacy=differential_privacy,
68
68
  model_state_strategy=ModelStateStrategy.resume if restarts > 0 else ModelStateStrategy.reuse,
69
69
  workspace_dir=workspace_dir,
File without changes