Prediction

Author, run, and deploy rebase.Predictor models.

rebase.Predictor is the model class for forecasting and regression: it exposes one cloud operation, predict(...). Deployed predictors get a versioned target, an SDK handle, and optionally an HTTP endpoint.

Author

Create add_model.py:

import rebase


class AddNumbersPredictor(rebase.Predictor):
    name = "add-numbers"

    def predict(self, a: float = 0, b: float = 0) -> dict:
        return {"sum": a + b}


model = AddNumbersPredictor()


if __name__ == "__main__":
    print(model.predict(a=2, b=3))

Run it locally:

python add_model.py

Run the same model in the cloud without deploying it — ephemeral model runs use target_type=model:

rebase run add_model.py --param a=2 --param b=3

Deploy and Invoke

Deploy (see Models for versioning, environments, and promotion):

rebase model deploy add_model.py --env dev

Call the deployed model through its SDK predict handle:

import rebase


model = rebase.get_predictor("default/add-numbers")
result = model.predict.remote(a=2, b=3)

print(result)

Run a specific model environment from the CLI:

rebase model run add-numbers --project default --env dev --param a=2 --param b=3

Real Forecasting Models

Production predictors are typically emflow Predictor subclasses — fit(train) on a leakage-safe training view, predict(obs) per forecast origin — which makes them backtestable on verifiable targets and searchable with hillclimb. The class that wins the backtest is the class you deploy.

On this page