mostlyai 0.3.6__tar.gz → 0.3.7__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-0.3.6 → mostlyai-0.3.7}/PKG-INFO +1 -1
- mostlyai-0.3.7/mostlyai/__init__.py +4 -0
- {mostlyai-0.3.6 → mostlyai-0.3.7}/mostlyai/api.py +15 -2
- {mostlyai-0.3.6 → mostlyai-0.3.7}/mostlyai/utils.py +19 -6
- {mostlyai-0.3.6 → mostlyai-0.3.7}/pyproject.toml +7 -1
- mostlyai-0.3.6/mostlyai/__init__.py +0 -3
- {mostlyai-0.3.6 → mostlyai-0.3.7}/LICENSE +0 -0
- {mostlyai-0.3.6 → mostlyai-0.3.7}/README.md +0 -0
- {mostlyai-0.3.6 → mostlyai-0.3.7}/mostlyai/base.py +0 -0
- {mostlyai-0.3.6 → mostlyai-0.3.7}/mostlyai/connectors.py +0 -0
- {mostlyai-0.3.6 → mostlyai-0.3.7}/mostlyai/exceptions.py +0 -0
- {mostlyai-0.3.6 → mostlyai-0.3.7}/mostlyai/generators.py +0 -0
- {mostlyai-0.3.6 → mostlyai-0.3.7}/mostlyai/model.py +0 -0
- {mostlyai-0.3.6 → mostlyai-0.3.7}/mostlyai/shares.py +0 -0
- {mostlyai-0.3.6 → mostlyai-0.3.7}/mostlyai/synthetic_datasets.py +0 -0
|
@@ -264,7 +264,14 @@ class MostlyAI(_MostlyBaseClient):
|
|
|
264
264
|
:param progress_bar: If true, then the progress bar will be displayed, in case of wait=True
|
|
265
265
|
:return: The created synthetic dataset.
|
|
266
266
|
"""
|
|
267
|
-
config = _harmonize_sd_config(
|
|
267
|
+
config = _harmonize_sd_config(
|
|
268
|
+
generator,
|
|
269
|
+
get_generator=self.generators.get,
|
|
270
|
+
size=size,
|
|
271
|
+
seed=seed,
|
|
272
|
+
config=config,
|
|
273
|
+
name=name,
|
|
274
|
+
)
|
|
268
275
|
sd = self.synthetic_datasets.create(config)
|
|
269
276
|
rich.print(
|
|
270
277
|
f"Created synthetic dataset "
|
|
@@ -302,7 +309,13 @@ class MostlyAI(_MostlyBaseClient):
|
|
|
302
309
|
:param seed: Optional. Either a single pandas DataFrame data, or a path to a CSV or PARQUET file, or list of samples, or a dictionary of those. Used for seeding the subject table(s).
|
|
303
310
|
:return: The created synthetic probe.
|
|
304
311
|
"""
|
|
305
|
-
config = _harmonize_sd_config(
|
|
312
|
+
config = _harmonize_sd_config(
|
|
313
|
+
generator,
|
|
314
|
+
get_generator=self.generators.get,
|
|
315
|
+
size=size,
|
|
316
|
+
seed=seed,
|
|
317
|
+
config=config,
|
|
318
|
+
)
|
|
306
319
|
dfs = self.synthetic_probes.create(config)
|
|
307
320
|
if return_type == "auto" and len(dfs) == 1:
|
|
308
321
|
return list(dfs.values())[0]
|
|
@@ -160,31 +160,44 @@ Seed = Union[pd.DataFrame, str, Path, list[dict[str, Any]]]
|
|
|
160
160
|
|
|
161
161
|
def _harmonize_sd_config(
|
|
162
162
|
generator: Union[Generator, str, None] = None,
|
|
163
|
+
get_generator: Union[Callable[[str], Generator], None] = None,
|
|
163
164
|
size: Union[int, dict[str, int], None] = None,
|
|
164
165
|
seed: Union[Seed, dict[str, Seed], None] = None,
|
|
165
166
|
config: Union[dict, None] = None,
|
|
166
167
|
name: Optional[str] = None,
|
|
167
168
|
) -> dict:
|
|
168
169
|
config = config or {}
|
|
169
|
-
|
|
170
|
+
size = size if size is not None else {}
|
|
171
|
+
seed = seed if seed is not None else {}
|
|
170
172
|
|
|
171
|
-
# insert generatorId into config
|
|
172
173
|
if isinstance(generator, Generator):
|
|
173
|
-
|
|
174
|
+
generator_id = str(generator.id)
|
|
174
175
|
elif generator is not None:
|
|
175
|
-
|
|
176
|
+
generator_id = str(generator)
|
|
176
177
|
elif "generatorId" not in config:
|
|
177
178
|
raise ValueError(
|
|
178
179
|
"Either a generator or a configuration with a generatorId must be provided."
|
|
179
180
|
)
|
|
180
181
|
|
|
182
|
+
if (
|
|
183
|
+
not isinstance(size, dict)
|
|
184
|
+
or not isinstance(seed, dict)
|
|
185
|
+
or "tables" not in config
|
|
186
|
+
):
|
|
187
|
+
if not isinstance(generator, Generator):
|
|
188
|
+
generator = get_generator(generator_id)
|
|
189
|
+
subject_tables = _get_subject_table_names(generator)
|
|
190
|
+
else:
|
|
191
|
+
subject_tables = []
|
|
192
|
+
|
|
193
|
+
# insert generatorId into config
|
|
194
|
+
config["generatorId"] = generator_id
|
|
195
|
+
|
|
181
196
|
# normalize size
|
|
182
|
-
size = size if size is not None else {}
|
|
183
197
|
if not isinstance(size, dict):
|
|
184
198
|
size = {table: size for table in subject_tables}
|
|
185
199
|
|
|
186
200
|
# normalize seed
|
|
187
|
-
seed = seed if seed is not None else {}
|
|
188
201
|
if not isinstance(seed, dict):
|
|
189
202
|
seed = {table: seed for table in subject_tables}
|
|
190
203
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[tool.poetry]
|
|
2
2
|
name = "mostlyai"
|
|
3
|
-
version = "0.3.
|
|
3
|
+
version = "0.3.7"
|
|
4
4
|
description = "The official Python client for the MOSTLY AI platform."
|
|
5
5
|
homepage = "https://app.mostly.ai/"
|
|
6
6
|
authors = ["MOSTLY AI <office@mostly.ai>"]
|
|
@@ -31,6 +31,7 @@ commitizen = "^3.18.0"
|
|
|
31
31
|
mkdocs = "^1.5.3"
|
|
32
32
|
mkdocstrings = "^0.24.1"
|
|
33
33
|
mkdocs-material = "^9.5.13"
|
|
34
|
+
poetry-bumpversion = "^0.3.2"
|
|
34
35
|
|
|
35
36
|
[tool.mypy]
|
|
36
37
|
python_version = "3.9"
|
|
@@ -51,6 +52,11 @@ version_provider = "poetry"
|
|
|
51
52
|
update_changelog_on_bump = true
|
|
52
53
|
major_version_zero = true
|
|
53
54
|
|
|
55
|
+
[[tool.poetry_bumpversion.replacements]]
|
|
56
|
+
files = ["mostlyai/__init__.py"]
|
|
57
|
+
search = '__version__ = "{current_version}"'
|
|
58
|
+
replace = '__version__ = "{new_version}"'
|
|
59
|
+
|
|
54
60
|
[build-system]
|
|
55
61
|
requires = ["poetry-core"]
|
|
56
62
|
build-backend = "poetry.core.masonry.api"
|
|
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
|