Skip to main content
All CollectionsGenerating Predictions
Using Your Model To Schedule Automated Prediction Cycles
Using Your Model To Schedule Automated Prediction Cycles

Download or send predictions back to your data warehouse for intelligent, quick, and confident data-driven decisions.

Ori Sagi avatar
Written by Ori Sagi
Updated over 7 months ago

Once you train a model that answers your predictive question, you can start connecting fresh data to Pecan to create up-to-date ongoing predictions.
​​

What does it mean to predict with a machine-learning model?

When predicting a model (also - deploying a model, or making a model go “live”), you can:

  • Generate predictions for newly-provided entities

  • Download a CSV with the predictions

  • Send (or export) the predictions to a destination of your choice, such as your data warehouse or your marketing attribution system; Pecan offers a variety of options you can send your predictions to

  • Schedule automatic generation of predictions on a timely basis

Things to do before you can schedule predictions

  1. Use a "live" data connection (i.e., not a static CSV) as its data source. If you want to use a CSV to create predictions, please check this article.

  2. If you want to send your predictions to your data warehouse, you must have a ready “write” connection to send them to. Follow this guide to create one if you don’t have it set up yet. If you prefer to download a CSV, you can skip this step.

How to set up and get your predictions

  1. Go to the predictive flow you want to predict with and click the “Predict” tab on the top of the screen:

  2. Fill out all the fields:

    Input configuration

    • Edit Source Query: This query creates a table of the entities you want to get predictions for. It is mostly identical to the "sampled" cell in your predictive notebook (cell named sampled_users, sampled_customers, etc.). You can adjust this query to ensure Pecan will produce predictions for the entities you want. Usually, the change refers to timeframes (i.e., taking users from all timeframes instead of the last two years).
      Note that it must include the same columns that were used for training.

    Output configuration

    • Destination: Select the connection to which you'd like to send your model's predictions. If you leave this empty, you will be able to manually download your predictions as a CSV from this screen once they are ready.

      To be able to select a destination for your predictions, you need to create a “write” type connection. Each connection can be either “read” or “write”, so two connections are required even if it is from and to the same destination. Once you create a “write” connection, you can select if from the dropdown.

    • Path: Pecan will write the table into this path in your data warehouse. Please follow this path structure to ensure a valid export: DB_NAME.SCHEMA_NAME.TABLE_NAME

    • Format Output Query (optional): Using SQL, you can manipulate the predictions output table. Common manipulations are related to the column names you would like to see.
      The default columns there are:
      - entity_id: The identifier you used to identify your entities (user ID, SKU, etc).
      - Marker: The time for which the prediction was given

      - 0 : The probability that the wanted result WILL NOT happen, or the predicted value in regression models

      - 1 : The probability that the wanted result WILL happen (for classification models only)

      Remember that ` (backtick) and (single quote) represent different things when using this option. For example, while `entity_id` would address the entity_id column in the RESULTS table, ‘entity_id’ will produce a string that says “entity_id”.

  3. Scheduling your predictions (optional):

    You can select the frequency you'd like the model to run on the fresh entities and produce predictions. You can choose between daily, weekly, or monthly frequencies and the time of day (in your local time) they would run.
    You can use the "advanced" option if you'd like to set up a cron expression for a more custom frequency.

    If you want to run the predictions manually, simply click "One-Time Run" instead of scheduling.

  4. Getting your predictions:
    You can download all your prediction batches as CSV files from this screen by clicking the ⠇ menu next to the batch:

    If you configured the predictions to be sent back to your data warehouse, they will wait for you there.
    If you can't see them, you can check the logs in your 'write' connection history tab to see if Pecan had issues writing your predictions to your data warehouse and the cause for this issue.

How does your model get data to produce predictions?

Each time your predictive model executes, it automatically imports fresh data from the tables the model uses. This up-to-date data serves as the basis for identifying new entities and their corresponding attributes, which are crucial for generating accurate and current predictions.

Pecan can re-import the entire table or fetch only new rows - depending on your table settings (read more here).

This process ensures that your model's insights are based on the most recent and relevant information, allowing for timely and informed decision-making.


Need help in setting up your predictions?

Just drop us a line via our chat or send us an email and you'll be up and running in no time!

Did this answer your question?