RelFMTabular
relationalai.semantics.reasoners.predictive
RelFMTabular( *, database: str, schema: str, context: b.Concept, label_column: str, task_type: str, validation: Optional[b.Concept] = None, eval_metric: Optional[str] = None, time_column: Optional[str] = None, item_id_column: Optional[str] = None, max_context_length: Optional[int] = None, test_batch_size: Optional[int] = None, stream_logs: bool = True, dataset_alias: Optional[str] = None, device: Literal["cpu", "cuda"] = "cpu", n_estimators: int = 8, random_state: Optional[int] = 42, sample_size: Optional[int] = None, sampling_strategy: str = "stratified", clamp_min: Optional[int] = 0, clamp_max: Optional[int] = 100, regression_output: Literal["point", "distribution"] = "point", quantile_levels: Optional[List[float]] = None, norm_methods: Optional[Union[str, List[str]]] = None) -> Union[RelFMTabularPredictor, RelFMTabularForecaster]Predict in-context with RelFM on a single flat table — no relational joins.
Standalone alternative to RelFM
for data that’s already one flat table per split (features + label all on the
same row) — no Graph, no shared entity Concept across splits, no
Relationship wrapping. Each of context/validation/the domain passed
to predictions()/forecast() is its own Concept.
A thin factory: dispatches to RelFMTabularPredictor (classification/
regression) or RelFMTabularForecaster (forecasting) based on
task_type, since the two have disjoint parameters and validation. Construct
that subclass directly instead if you want static type-checking of exactly
which parameters apply.
Parameters
(databasestr) - Snowflake database to save predictions in.
(schemastr) - Snowflake schema to save predictions in.
(contextConcept) - Labeled split (or, for forecasting, the history/panel Concept), used directly as in-context examples (RelFM has no training step).
(label_columnstr) - Name of the label/value property oncontext/validation.
(task_typestr) - One of"binary_classification","multiclass_classification","regression", or"forecasting".
(validationConcept, default:None) - Optional labeled validation split. Does not need to be the same Concept ascontext— only needs the same feature columns.
(eval_metricstr, default:None) - Evaluation metric compatible with the chosentask_type. For"forecasting":"mae","rmse", or"mape".
(time_columnstr, default:None) - Datetime property name. Required whentask_type="forecasting".
(item_id_columnstr, default:None) - Series-partition property name for panel/multi-series forecasting. Forecasting-only.
(max_context_lengthint, default:None) - Max history length (in time steps) looked back over. Required whentask_type="forecasting".
(test_batch_sizeint, default:None) - Batch size used during inference. Default is256.
(stream_logsbool, default:True) - Stream logs to stdout. Default isTrue.
(dataset_aliasstr, default:None) - User chosen alias for the dataset.
(devicestr, default:“cpu”) - Inference device,"cpu"(default) or"cuda".
(n_estimatorsint, default:8) - Ensemble size. More = better quality, slower inference. Default is8.
(random_stateint, default:42) - Seed for ensemble generation and context sampling. Default is42.
(sample_sizeint, default:None) - Max context rows sampled fromcontext. Default (None) uses all rows.
(sampling_strategystr, default:“stratified”) - How to draw the context sample:"stratified"(default),"most_recent","mixed","random", or"balanced".
(clamp_minint, default:0) - Min percentile clamp for regression predictions. Default is0. Classification/regression-only.
(clamp_maxint, default:100) - Max percentile clamp for regression predictions. Default is100. Classification/regression-only.
(regression_outputstr, default:“point”) -"point"(default) or"distribution". Classification/regression-only.
(quantile_levelslist of float, default:None) - Quantile levels output whenregression_output="distribution"or for forecasting tasks.
(norm_methodsstr or list of str, default:None) - Feature normalization method(s).
Returns
RelFMTabularPredictor or RelFMTabularForecaster- ARelFMTabularForecasterwhentask_type="forecasting", otherwise aRelFMTabularPredictor.
Examples
relfm_tabular = RelFMTabular( database="MYDB", schema="MYSCHEMA", context=Customer, label_column="lifetime_value", task_type="regression", eval_metric="rmse",)Customer.predictions = relfm_tabular.predictions(domain=TestCustomer)