Model Training with Ludwig#

1. Installation#

To use the Ludwig framework, we need to install the extra ludwig dependency in your EvaDB virtual environment.

pip install evadb[ludwig]

2. Example Query#

CREATE OR REPLACE FUNCTION PredictHouseRent FROM
( SELECT sqft, location, rental_price FROM HomeRentals )
TYPE Ludwig
PREDICT 'rental_price'
TIME_LIMIT 120;

In the above query, you are creating a new customized function by automatically training a model from the HomeRentals table. The rental_price column will be the target column for predication, while sqft and location are the inputs.

You can also simply give all other columns in HomeRentals as inputs and let the underlying AutoML framework to figure it out. Below is an example query:

CREATE FUNCTION IF NOT EXISTS PredictHouseRent FROM
( SELECT * FROM HomeRentals )
TYPE Ludwig
PREDICT 'rental_price'
TIME_LIMIT 120;

Note

Check out our Prediction for working example.

3. Model Training Parameters#

Available Parameters#

PREDICT (required)

The name of the column we wish to predict.

TIME_LIMIT

Time limit to train the model in seconds. Default: 120.

TUNE_FOR_MEMORY

Whether to refine hyperopt search space for available host / GPU memory. Default: False.

Below is an example query specifying the above parameters:

CREATE FUNCTION IF NOT EXISTS PredictHouseRent FROM
( SELECT * FROM HomeRentals )
TYPE Ludwig
PREDICT 'rental_price'
TIME_LIMIT 3600
TUNE_FOR_MEMORY True;