outerproduct.reasoning module is the entry point for training reasoning models and analysing their behaviour across populations. op.reasoning.fit() trains a ReasoningModel that produces both predictions and feature-level attributions. op.reasoning.pattern_tracker.fit() takes a fitted ReasoningModel and condenses its explanations over a target prediction band into a small set of named, executable filter patterns you can apply to any new data.
op.reasoning.fit()
Job handle immediately. Call .wait() on the handle to block until training completes and receive the trained ReasoningModel.
Parameters
Training data wrapped in an
op.Dataset. Build one with op.LocalDataset.from_pandas(df).upload(), op.LocalDataset.from_csv(...).upload(), or any other LocalDataset constructor, or reference a connector. The column you name in task’s label_column (or the labels supplied by teacher) is used as the target; all remaining columns are treated as features.The supervised learning task, which carries the target
Required unless
label_column. Pass the config that matches your problem:| Config | Use when |
|---|---|
op.Binclass(label_column=...) | Binary classification (e.g. churn, fraud, approval) |
op.Multiclass(label_column=...) | Multi-class classification (three or more discrete classes) |
op.Regression(label_column=...) | Continuous numerical target |
op.Forecasting(label_column=..., id_column=..., timestamp_column=..., horizon=..., lookback=...) | Time-series forecasting |
op.SequenceBinclass(label_column=..., id_column=..., timestamp_column=...) | Per-entity binary classification over each entity’s sequence |
op.SequenceMulticlass(label_column=..., id_column=..., timestamp_column=...) | Per-entity multi-class classification over each entity’s sequence |
op.SequenceRegression(label_column=..., id_column=..., timestamp_column=...) | Per-entity regression over each entity’s sequence (accepted, not yet executable) |
teacher is provided. When a teacher is set, OuterProduct queries it to generate training labels and task becomes optional.Restrict the model family search to a specific list, e.g.
["tabm", "xgboost"]. When None, OuterProduct selects from its full portfolio of model families. Providing this list is useful when you have a latency or interpretability constraint that rules out certain architectures.The optimization target(s). Pass a single
op.Metric to optimize directly, or a list to trigger a Pareto sweep across their weightings. When None, OuterProduct picks a sensible default for the task.Number of hyperparameter optimisation trials to run. Higher values improve model quality at the cost of longer training time. Defaults to
5.Seed for the training search, for reproducible runs. Defaults to
42.A teacher model for knowledge distillation. Accepts either a previously trained OuterProduct
Model / ReasoningModel or a Predictor wrapping an external HTTP scoring endpoint. When set, OuterProduct trains the new ReasoningModel to mimic the teacher’s output, adding full reasoning to a black-box predictor.Return value
A non-blocking job handle. The job runs on OuterProduct’s hosted infrastructure. Use the methods below to interact with it.
Examples
op.reasoning.pattern_tracker.fit()
ReasoningModel’s explanation behaviour on a specific prediction band into a compact, portable set of named filter patterns. The fitted PatternTracker can then be applied to any schema-compatible dataset to score rows against those patterns.
Parameters
A trained
ReasoningModel (produced by op.reasoning.fit().wait()). The tracker learns from this model’s explanations over the supplied dataset.The dataset used to fit the tracker. The tracker analyses the model’s predictions and attributions over these rows to extract recurring patterns within the
target_range.An inclusive prediction band that defines which rows are considered “positive” examples for pattern extraction. Either bound may be
None for an open-ended range; at least one bound must be set.target_range | Selects |
|---|---|
(0.5, None) | pred >= 0.5, likely-positive cohort |
(None, 0.5) | pred <= 0.5, likely-negative cohort |
(0.4, 0.6) | 0.4 <= pred <= 0.6, borderline / uncertain band |
Return value
A non-blocking job handle. Call
.wait() to block until fitting completes and receive the PatternTracker. You can also poll with .status() or access the raw payload with .results().PatternTracker
PatternTracker is produced by op.reasoning.pattern_tracker.fit().wait(). It holds a set of named filter patterns and can score any schema-compatible dataset against them.
Attributes
The patterns discovered during fitting. Each entry is a
FilterPattern with a human-readable label and quality metrics. See FilterPattern below.Fraction of rows in the fitting dataset that are matched by at least one pattern. A value of
0.82 means 82 % of the fitting set falls under at least one named pattern.Methods
pt.transform()
DataFrame of shape (n_rows, n_patterns). Each column corresponds to one pattern (named by FilterPattern.label); a cell is True if that row matches that pattern. Rows can match multiple patterns simultaneously.
New data to score. Must be schema-compatible with the dataset used to fit the tracker.
Boolean DataFrame of shape
(n_rows, n_patterns). Column names match the FilterPattern.label values in pt.patterns.pt.distribution()
X that match each pattern) as a pd.Series indexed by pattern label.
New data to score.
Float Series of shape
(n_patterns,), indexed by FilterPattern.label. Values are in [0, 1].pt.partition()
X that match it. Useful when you want to extract the actual rows belonging to each pattern segment.
New data to score.
Mapping from pattern label to a 1-D integer array of matching row indices. A row may appear under multiple pattern labels.
Full usage example
FilterPattern
A single named pattern discovered by thePatternTracker.
A human-readable name for the pattern, generated by OuterProduct to summarise the feature conditions that define it (e.g.
"high_credit_low_income").Fraction of rows matching this pattern whose prediction also falls within
target_range. Higher precision means the pattern is a more reliable indicator of the target cohort. Values are in [0, 1].Ratio of the pattern’s precision to the base rate of
target_range in the fitting dataset. A lift of 2.0 means rows matching this pattern are twice as likely to fall in the target band as a randomly chosen row.