Skip to main content

Tabular Scoring

Tabular scoring algorithms are used to predict a continuous value based on tabular data. They are used in a variety of applications, such as predicting the price of a house based on its features, time series forecasting, or predicting the number of sales based on historical data.

Currently, the TrueState platform supports XGBoost, a popular gradient boosting algorithm, for tabular scoring tasks.

Train a tabular scoring model

from truestate import datasets, models

# get the dataset
dataset = datasets.get(name="my-dataset")

# train the model
model = models.TabularScorer(
name="my-model",
model="xgboost"
)

model.train(
dataset=dataset
target_column="target",
features=["feature1", "feature2"]
)

Specify hyperparameters

Hyperparameters can be specified using the hyperparameters parameter. The following hyperparameters are supported:

  • num_boost_round: The number of boosting rounds.
  • learning_rate: The learning rate.
from truestate import datasets, models

# get the dataset
dataset = datasets.get(name="my-dataset")

# train the model
model = models.TabularScorer(
name="my-model",
model="xgboost",
hyperparameters={
"num_boost_round": 100,
"learning_rate": 0.1,
}
)

model.train(
dataset=dataset,
target_column="target",
features=["feature1", "feature2"],
)

Apply the model to new data

from truestate import models, datasets

# get the model
model = models.get(name="my-model")

# get the dataset
dataset = datasets.get(name="my-dataset")

# apply the model to the dataset
predictions = model.inference(
dataset=dataset,
)