Predictive Queries
After you have set up the Graph of your Tables, you can define a machine learning problem as a Kumo PredictiveQuery.
Predictive queries use the predictive query language (PQL), a concise SQL-like syntax for defining models for new business problems.
Refer to the PQL structure guide for details on query string construction.
Writing a Query
This example predicts customer lifetime value as a regression problem. The query finds the maximum quantity of transactions for each customer over the next 30 days, for customers who have made over 15 units worth of transactions in the past 7 days:
Validating a Query
The SDK provides quick ways to confirm your query matches expectations before generating data.
validate()checks for syntax errors and guides you toward a correct formulation.get_task_type()returns the task type of the query (for example, binary classification or regression) so you can confirm the ML problem matches your intent.
Generating a Training Table
After your query is validated, generate a training table to use for model fitting:
If you do not need a custom plan, omit it and Kumo uses a suitable default.
Generating a Prediction Table
Generate a prediction table using the same approach: