Skip to content

RelFMTabularPredictor

relationalai.semantics.reasoners.predictive
RelFMTabularPredictor(
*,
database: str,
schema: str,
context: b.Concept,
label_column: str,
task_type: str,
validation: Optional[b.Concept] = None,
eval_metric: Optional[str] = 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
)

Classification/regression flat-table RelFM — see RelFMTabular.

Parameters

  • database

    (str) - Snowflake database to save predictions in.
  • schema

    (str) - Snowflake schema to save predictions in.
  • context

    (Concept) - Labeled split, used directly as in-context examples (RelFM has no training step). Must be identified by a single natural-key property and carry label_column among its own properties.
  • label_column

    (str) - Name of the label property on context/validation.
  • task_type

    (str) - One of "binary_classification", "multiclass_classification", or "regression".
  • validation

    (Concept, default: None) - Optional labeled validation split. Does not need to be the same Concept as context — only needs the same feature columns.
  • eval_metric

    (str, default: None) - Evaluation metric compatible with the chosen task_type.
  • test_batch_size

    (int | None, default: None)
  • stream_logs

    (int | None, default: None)
  • dataset_alias

    (int | None, default: None)
  • device

    (int | None, default: None)
  • n_estimators

    (int | None, default: None)
  • random_state

    (int | None, default: 42) - See RelFMTabular.
  • sample_size

    (int | None, default: 42) - See RelFMTabular.
  • sampling_strategy

    (int | None, default: 42) - See RelFMTabular.
  • quantile_levels

    (int | None, default: 42) - See RelFMTabular.
  • norm_methods

    (int | None, default: 42) - See RelFMTabular.
  • clamp_min

    (int, default: 0) - Min percentile clamp for regression predictions. Default is 0.
  • clamp_max

    (int, default: 100) - Max percentile clamp for regression predictions. Default is 100.
  • regression_output

    (str, default: “point”) - "point" (default) or "distribution".

Examples

relfm_tabular = RelFMTabularPredictor(
database="MYDB",
schema="MYSCHEMA",
context=Customer,
label_column="lifetime_value",
task_type="regression",
eval_metric="rmse",
)
Customer.predictions = relfm_tabular.predictions(domain=TestCustomer)

Methods

.predictions()

RelFMTabularPredictor.predictions(domain: b.Concept) -> b.Relationship

Generate predictions for every row of an unlabeled domain Concept.

Parameters:

  • domain

    (Concept) - Unlabeled Concept to predict for — identified by a single natural-key property, carrying the same feature columns as context (no label_column).

Returns:

  • Relationship - A prediction relationship: {domain} -> prediction, to be assigned to a field for downstream querying.

Inheritance Hierarchy

RelFMTabularPredictor_RelFMTabularBase