Skip to main content

Welcome to a Grasp lesson

Create a free account to keep studying and create your own study path.

Lesson 49

Generating Predictions with the Score Tool

Recommended resources

Hello! Let's dive into the next step of our predictive modeling journey in Alteryx.

In our previous lessons, you've learned how to build a linear regression model, interpret its statistical report, and, crucially, validate that it meets the key assumptions for reliability. Now that we have a trained and validated model, it's time to put it to work.

Today's lesson focuses on a practical and essential step in the predictive workflow. Our goal is to use the Score tool to generate predictions on a new dataset. This is the process of taking your abstract model and using it to produce concrete, actionable forecasts on data it hasn't seen before.

From Training to Prediction: The Workflow

Before we focus on the Score tool, let's quickly place it within the standard predictive modeling process in Alteryx:

  1. Prepare Data: You start with your historical data, which you clean and prepare. A key step here, as we've seen, is using the Create Samples tool to split your data into a training set (to build the model) and a testing set (to evaluate it).
  2. Train Model: You feed the training set into a predictive tool, like the Linear Regression tool. The output of this step isn't just a report; it's a model "object" (coming from the 'O' output anchor), which is essentially the mathematical formula the tool learned from your data.
  3. Score Data: This is our focus today. You use the Score tool to apply the model object to a dataset to generate predictions. This dataset can be your testing set or a completely new set of data (e.g., new customers, future sales periods).
  4. Evaluate Model: After scoring your testing set, you compare the predictions to the actual, known outcomes to measure your model's accuracy. We will cover this in detail in our next lesson.

Using the Score Tool on a Test Dataset

The most immediate use for the Score tool is to generate predictions on your holdout or test dataset. This allows you to see how well your model performs on data it wasn't trained on.

The following article from The Data School provides a clear, step-by-step example of this exact workflow.

Alteryx Tip #3: Doing linear regressions the easy way!

This article, 'Alteryx Tip #3: Doing linear regressions the easy way!', walks through a complete workflow from data sampling to scoring. It perfectly illustrates how the Score tool fits into the process after a model has been trained.

Please read the sections titled 'Creating your Training and Test datasets' and 'Building your regression model and testing its accuracy'. Pay close attention to the workflow diagram and how the Linear Regression and Score tools are connected.

As you saw in the article, the process is straightforward once you understand the connections:

  1. Inputs to the Score Tool: The Score tool, found in the Predictive tool palette, has two input anchors:

    • M (Model): This anchor receives the model object. You connect the 'O' (Object) output from your Linear Regression tool to this anchor.
    • D (Data): This anchor receives the data you want to score. You connect the 'V' (Validation) output from your Create Samples tool to this anchor.
  2. Configuration: A key takeaway from the article is that the Score tool itself requires almost no configuration. Its job is simply to apply the logic from the model object to the incoming data.

  3. Output: The Score tool passes through all the original columns from your input data and appends a new column, named Score by default. This new column contains the predicted value for each row. The article's final image shows this clearly, with the original Sum_Sales column next to the new, predicted Score column.


Scoring a Completely New Dataset

While scoring a test set is vital for evaluation, the ultimate goal of many predictive models is to make predictions on entirely new data for which the outcome is unknown. For example, you might train a model on existing customer data to predict the potential spending of a list of new marketing leads.

The workflow is very similar, but instead of using your test set, you connect your new data to the Score tool's 'D' anchor. The following article presents a business problem that illustrates this scenario.

Why is Alteryx best for building linear regression models?

This article from Medium, 'Why is Alteryx best for building linear regression models?', frames a business problem where the goal is to predict profit from a list of 250 new customers.

Read the 'Problem Statement', 'Score', and 'Result' sections. Focus on the overall goal: using a model trained on existing customers to predict an outcome for a new mailing list.

This second use case highlights a critical concept for real-world application. Here's the setup:

  • Model Training: You use a Linear Regression tool on your historical data (e.g., Existing_Customers.csv).
  • Scoring New Data: You connect the resulting model object to the Score tool's 'M' input. Then, you connect your new data (e.g., Mailing_List.csv) to the 'D' input.

The Score tool will then append a prediction to each of the 250 new customers on the mailing list, allowing the business to estimate potential profit.

This workflow, adapted from the Medium article, shows a model being trained on 'Customers' data and then applied via the Score tool to a new 'Mailing List' dataset.

An Important Clarification:
The Medium article, in its "Score" section, mentions that the tool outputs "Yes" and "No" columns. This is incorrect for a linear regression model. That type of output belongs to classification models (like Logistic Regression), which predict categories. We will cover those later in the course.

For a linear regression model, which predicts a continuous value (like sales, profit, or temperature), the Score tool outputs a single numeric column containing the predicted value. It's a crucial distinction to remember.


Putting It All Together

Let's visualize the final output. After using the Score tool, your data stream will contain your original data plus the new prediction column.

Alteryx Linear Regression Model Output and Predictions
The output of a Score tool is a table like this. It includes the original data fields alongside a new field containing the model's predictions (here named 'Predicted_Medv_fit').

Quick Review

Imagine your workflow has two main data streams:

  1. A model object coming from the 'O' anchor of a Linear Regression tool.
  2. A new dataset of potential customers loaded with an Input Data tool.

How would you connect these streams to a Score tool to generate predictions for the new customers?

Answer You would connect the model object stream to the **'M' (Model) input anchor** of the Score tool. You would then connect the new customer data stream to the **'D' (Data) input anchor** of the Score tool.

Conclusion

You have now learned how to operationalize your predictive model. By using the Score tool, you've bridged the gap between training a model and using it to generate valuable, forward-looking predictions.

Key Takeaways:

  • The Score tool applies a trained model object to a dataset to generate predictions.
  • It requires two inputs: the model object ('M' anchor) and the data to be scored ('D' anchor).
  • For a linear regression model, the Score tool appends a single column containing the predicted numeric values.
  • This process can be used to score a test set for model evaluation or to generate forecasts for new, unseen data.

Preview of the Next Lesson:

We've generated predictions, but how good are they? In our next lesson, we will tackle the final step in the modeling process: evaluating model performance by comparing predicted vs. actual values. You'll learn about key metrics like Root Mean Square Error (RMSE) and Mean Absolute Error (MAE) that tell you just how accurate your model is.