proxyml 0.8.0__tar.gz → 0.9.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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: proxyml
3
- Version: 0.8.0
3
+ Version: 0.9.0
4
4
  Summary: Python SDK for calling the ProxyML API
5
5
  Author-email: ProxyML <contact@proxyml.ai>
6
6
  License: Apache License
@@ -211,7 +211,7 @@ Requires-Dist: pandas>=1.5
211
211
  Requires-Dist: orjson>=3.9
212
212
  Requires-Dist: proxyml-core>=0.1
213
213
  Provides-Extra: local
214
- Requires-Dist: proxyml-core[modeling]>=0.2.1; extra == "local"
214
+ Requires-Dist: proxyml-core[modeling]>=0.2.2; extra == "local"
215
215
  Provides-Extra: dev
216
216
  Requires-Dist: build; extra == "dev"
217
217
  Requires-Dist: twine; extra == "dev"
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "proxyml"
7
- version = "0.8.0"
7
+ version = "0.9.0"
8
8
  description = "Python SDK for calling the ProxyML API"
9
9
  readme = "README.md"
10
10
  license = {file = "LICENSE"}
@@ -35,7 +35,7 @@ dependencies = [
35
35
 
36
36
  [project.optional-dependencies]
37
37
  local = [
38
- "proxyml-core[modeling]>=0.2.1",
38
+ "proxyml-core[modeling]>=0.2.2",
39
39
  ]
40
40
  dev = [
41
41
  "build",
@@ -27,6 +27,7 @@ from sklearn.pipeline import Pipeline
27
27
 
28
28
  from proxyml.schema_builder import get_schema
29
29
  from proxyml_core.export import SurrogateExport
30
+ from proxyml_core.fingerprint import FINGERPRINT_MISMATCH_MESSAGE, check_fingerprints
30
31
  from proxyml_core.modeling.estimators import (
31
32
  binarize_if_probabilities,
32
33
  extract_hyperparameters,
@@ -350,6 +351,13 @@ def to_challenger_upload(
350
351
  itself still requires ``champion_metrics`` at upload time; this function
351
352
  just doesn't force you to have it up front.
352
353
 
354
+ If both fingerprints end up present and don't match, raises
355
+ ``ValueError`` immediately — via the same
356
+ ``proxyml_core.check_fingerprints``/``FINGERPRINT_MISMATCH_MESSAGE`` the
357
+ upload endpoint itself uses — rather than waiting for a round-trip to
358
+ the server to find out the challenger and champion were scored on
359
+ different data.
360
+
353
361
  Args:
354
362
  result: output of ``train_challenger()``/``train_auto_challenger()``.
355
363
  n_samples: size of the evaluation set both ``result.metrics`` and
@@ -400,6 +408,10 @@ def to_challenger_upload(
400
408
  payload["champion_data_fingerprint"] = fingerprint_labels(champion_labels)
401
409
  elif used_internal_champion_metrics:
402
410
  payload["champion_data_fingerprint"] = result.target_fingerprint
411
+ if check_fingerprints(
412
+ payload["challenger_data_fingerprint"], payload.get("champion_data_fingerprint")
413
+ ) is False:
414
+ raise ValueError(FINGERPRINT_MISMATCH_MESSAGE)
403
415
  return payload
404
416
 
405
417
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: proxyml
3
- Version: 0.8.0
3
+ Version: 0.9.0
4
4
  Summary: Python SDK for calling the ProxyML API
5
5
  Author-email: ProxyML <contact@proxyml.ai>
6
6
  License: Apache License
@@ -211,7 +211,7 @@ Requires-Dist: pandas>=1.5
211
211
  Requires-Dist: orjson>=3.9
212
212
  Requires-Dist: proxyml-core>=0.1
213
213
  Provides-Extra: local
214
- Requires-Dist: proxyml-core[modeling]>=0.2.1; extra == "local"
214
+ Requires-Dist: proxyml-core[modeling]>=0.2.2; extra == "local"
215
215
  Provides-Extra: dev
216
216
  Requires-Dist: build; extra == "dev"
217
217
  Requires-Dist: twine; extra == "dev"
@@ -12,4 +12,4 @@ black
12
12
  ruff
13
13
 
14
14
  [local]
15
- proxyml-core[modeling]>=0.2.1
15
+ proxyml-core[modeling]>=0.2.2
@@ -447,18 +447,15 @@ def test_to_challenger_upload_champion_labels_fingerprint_for_decoupled_path():
447
447
  assert payload["champion_data_fingerprint"] == result.target_fingerprint
448
448
 
449
449
 
450
- def test_to_challenger_upload_champion_labels_fingerprint_differs_for_different_data():
450
+ def test_to_challenger_upload_raises_on_fingerprint_mismatch():
451
451
  df = _labeled_df(seed=33)
452
452
  target = df["approved"]
453
453
  result = train_challenger(df, target, _schema(), task="classification")
454
454
  champion_metrics = score_champion(target, target, task="classification")
455
455
  other_labels = ~target
456
456
 
457
- payload = to_challenger_upload(
458
- result, champion_metrics=champion_metrics, champion_labels=other_labels
459
- )
460
-
461
- assert payload["challenger_data_fingerprint"] != payload["champion_data_fingerprint"]
457
+ with pytest.raises(ValueError, match="don't match"):
458
+ to_challenger_upload(result, champion_metrics=champion_metrics, champion_labels=other_labels)
462
459
 
463
460
 
464
461
  def test_to_challenger_upload_omits_champion_fingerprint_without_labels_or_internal_path():
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes