outerproduct 0.2.2__tar.gz → 0.2.3__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 (23) hide show
  1. {outerproduct-0.2.2 → outerproduct-0.2.3}/PKG-INFO +1 -1
  2. {outerproduct-0.2.2 → outerproduct-0.2.3}/pyproject.toml +1 -1
  3. {outerproduct-0.2.2 → outerproduct-0.2.3}/src/outerproduct/reasoning/pattern_tracker.py +18 -57
  4. {outerproduct-0.2.2 → outerproduct-0.2.3}/.gitignore +0 -0
  5. {outerproduct-0.2.2 → outerproduct-0.2.3}/LICENSE +0 -0
  6. {outerproduct-0.2.2 → outerproduct-0.2.3}/README.md +0 -0
  7. {outerproduct-0.2.2 → outerproduct-0.2.3}/src/outerproduct/__init__.py +0 -0
  8. {outerproduct-0.2.2 → outerproduct-0.2.3}/src/outerproduct/agentic/__init__.py +0 -0
  9. {outerproduct-0.2.2 → outerproduct-0.2.3}/src/outerproduct/agentic/documents.py +0 -0
  10. {outerproduct-0.2.2 → outerproduct-0.2.3}/src/outerproduct/client/__init__.py +0 -0
  11. {outerproduct-0.2.2 → outerproduct-0.2.3}/src/outerproduct/client/_http.py +0 -0
  12. {outerproduct-0.2.2 → outerproduct-0.2.3}/src/outerproduct/client/apis.py +0 -0
  13. {outerproduct-0.2.2 → outerproduct-0.2.3}/src/outerproduct/client/client.py +0 -0
  14. {outerproduct-0.2.2 → outerproduct-0.2.3}/src/outerproduct/client/endpoints.py +0 -0
  15. {outerproduct-0.2.2 → outerproduct-0.2.3}/src/outerproduct/client/exceptions.py +0 -0
  16. {outerproduct-0.2.2 → outerproduct-0.2.3}/src/outerproduct/connector.py +0 -0
  17. {outerproduct-0.2.2 → outerproduct-0.2.3}/src/outerproduct/dataset.py +0 -0
  18. {outerproduct-0.2.2 → outerproduct-0.2.3}/src/outerproduct/job.py +0 -0
  19. {outerproduct-0.2.2 → outerproduct-0.2.3}/src/outerproduct/model.py +0 -0
  20. {outerproduct-0.2.2 → outerproduct-0.2.3}/src/outerproduct/py.typed +0 -0
  21. {outerproduct-0.2.2 → outerproduct-0.2.3}/src/outerproduct/reasoning/__init__.py +0 -0
  22. {outerproduct-0.2.2 → outerproduct-0.2.3}/src/outerproduct/trainer.py +0 -0
  23. {outerproduct-0.2.2 → outerproduct-0.2.3}/src/outerproduct/utils.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: outerproduct
3
- Version: 0.2.2
3
+ Version: 0.2.3
4
4
  Summary: Python SDK for the OuterProduct API
5
5
  Project-URL: Documentation, https://docs.outerproduct.com
6
6
  Project-URL: Homepage, https://outerproduct.com
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "outerproduct"
3
- version = "0.2.2"
3
+ version = "0.2.3"
4
4
  description = "Python SDK for the OuterProduct API"
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.12"
@@ -1,13 +1,6 @@
1
- """PatternTracker — aggregate a :class:`ReasoningModel`'s local-rule
2
- explanations into a small, frozen set of labeled filter patterns.
3
-
4
- The fit dispatches to a one-shot Modal CPU function on the API server: it
5
- loads the cloudpickled ReasoningModel, materializes X from the supplied
6
- :class:`~outerproduct.dataset.Dataset` (inline / pre-uploaded /
7
- connector-backed — same routing as :func:`outerproduct.reasoning.fit`),
8
- runs ``predict`` + ``explain_prediction`` + ``build_patterns`` end-to-end,
9
- and persists the result. The SDK polls a single GET endpoint and returns
10
- the populated :class:`PatternTracker`.
1
+ """PatternTracker — aggregate a :class:`ReasoningModel`'s explanations on
2
+ a target prediction band into a small, frozen set of labeled filter
3
+ patterns.
11
4
 
12
5
  Quickstart
13
6
  ----------
@@ -17,7 +10,7 @@ Quickstart
17
10
 
18
11
  op.init(api_key="...")
19
12
  ds = op.FileUploadConnector().upload("data.csv")
20
- rm = op.reasoning.fit(ds)
13
+ rm = op.reasoning.fit(ds, label_column="churn", task_type="binclass")
21
14
  pt = op.reasoning.pattern_tracker.fit(rm, ds, target_range=(0.5, None))
22
15
 
23
16
  pt.patterns # tuple[FilterPattern, ...]
@@ -44,12 +37,10 @@ if TYPE_CHECKING:
44
37
 
45
38
  @dataclass(frozen=True)
46
39
  class Predicate:
47
- """One literal of a conjunctive filter: ``feature <op> value``.
40
+ """One literal of a filter: ``feature <op> value``.
48
41
 
49
- Mirrors the server-side
50
- ``outerproduct_reasoning.internal.local_rules.Predicate``. ``op`` is
51
- ``"<="`` or ``">="`` for continuous features (numeric ``value``) or
52
- ``"=="`` for categoricals.
42
+ ``op`` is ``"<="`` or ``">="`` for continuous features (numeric
43
+ ``value``) or ``"=="`` for categoricals.
53
44
  """
54
45
 
55
46
  feature: str
@@ -70,7 +61,7 @@ class Predicate:
70
61
 
71
62
  @dataclass(frozen=True)
72
63
  class FilterPattern:
73
- """One executable conjunctive filter with coverage stats and a label."""
64
+ """One executable filter with coverage stats and a label."""
74
65
 
75
66
  predicates: tuple[Predicate, ...]
76
67
  label: str
@@ -183,66 +174,36 @@ def fit(
183
174
  dataset: Dataset,
184
175
  *,
185
176
  target_range: tuple[float | None, float | None],
186
- mode: str = "discovery",
187
177
  max_patterns: int = 25,
188
- coverage_target: float = 0.95,
189
- min_pattern_support: float = 0.005,
190
- min_precision: float = 0.5,
191
- max_pattern_size: int = 3,
192
- threshold_n_bins: int = 10,
193
- ensure_coverage: bool = True,
194
- min_wracc: float = 0.0,
195
- diversity_threshold: float = 0.5,
196
- drop_redundant: bool = True,
197
- child_overlap_threshold: float = 0.9,
198
- explained_lift_threshold: float = 1.1,
199
- rule_kwargs: dict[str, Any] | None = None,
200
178
  non_blocking: bool = False,
201
179
  poll_interval: float = 2.0,
202
180
  poll_timeout: float = 3600.0,
203
181
  ) -> "PatternTracker | PatternTrackerJob":
204
- """Fit a :class:`PatternTracker` against ``reasoning_model`` over
205
- ``dataset``'s rows.
182
+ """Fit a :class:`PatternTracker` against ``reasoning_model`` on
183
+ ``dataset``.
206
184
 
207
185
  Parameters
208
186
  ----------
209
187
  reasoning_model : :class:`~outerproduct.model.ReasoningModel`
210
- The model whose rejected rows define the aggregation target.
188
+ The model whose target-band rows drive the aggregation.
211
189
  dataset : :class:`~outerproduct.dataset.Dataset`
212
- The data to score and aggregate. Inline / pre-uploaded /
213
- connector-backed datasets are all supported (same routing as
214
- :func:`outerproduct.reasoning.fit`).
190
+ Data to score and aggregate over.
215
191
  target_range : (lo, hi) tuple
216
- Inclusive prediction band that defines "rejected" rows. Either
217
- side may be ``None`` for an open bound; at least one must be set.
192
+ Inclusive prediction band that defines the target cohort.
193
+ Either side may be ``None`` for an open bound; at least one
194
+ must be set.
195
+ max_patterns : int, default 25
196
+ Cap on the number of returned patterns.
218
197
  non_blocking : bool, default False
219
198
  If ``True``, return a :class:`PatternTrackerJob` immediately;
220
- otherwise block until the fit completes and return the populated
221
- tracker.
222
-
223
- All remaining keyword arguments mirror the server-side fit
224
- hyperparameters; see ``outerproduct_reasoning.PatternTracker.fit``
225
- for their semantics.
199
+ otherwise block until the fit completes.
226
200
  """
227
201
  from outerproduct_http_types import PatternTrackerFitRequest
228
202
 
229
203
  dataset_payload = dataset._to_dataset_payload()
230
204
  payload: dict[str, Any] = {
231
205
  "target_range": target_range,
232
- "mode": mode,
233
206
  "max_patterns": max_patterns,
234
- "coverage_target": coverage_target,
235
- "min_pattern_support": min_pattern_support,
236
- "min_precision": min_precision,
237
- "max_pattern_size": max_pattern_size,
238
- "threshold_n_bins": threshold_n_bins,
239
- "ensure_coverage": ensure_coverage,
240
- "min_wracc": min_wracc,
241
- "diversity_threshold": diversity_threshold,
242
- "drop_redundant": drop_redundant,
243
- "child_overlap_threshold": child_overlap_threshold,
244
- "explained_lift_threshold": explained_lift_threshold,
245
- "rule_kwargs": rule_kwargs,
246
207
  }
247
208
  payload.update(dataset_payload)
248
209
 
File without changes
File without changes
File without changes