Mining Model Prediction

The Mining Model Prediction functions allow you to generate predictions from a data mining model that is stored in an Analysis Services cube. These functions can be used in T‑SQL queries, stored procedures, and client‑side applications to retrieve predictive results such as classifications, regressions, and clustering assignments.

Syntax

Transact‑SQL
SELECT
    PREDICTION(
        MODEL = <MiningModelName>,
        PREDICTIVE_COL = <PredictiveColumnName>,
        INPUT = ( <column_name_1=> value1,
                  <column_name_2=> value2,
                  ... )
    ) AS PredictedValue
FROM <YourTableOrView>;

Example

This example demonstrates how to predict the CustomerSegment for a new customer using the CustomerSegmentationModel that was previously trained.

Transact‑SQL
SELECT
    PREDICTION(
        MODEL = N'CustomerSegmentationModel',
        PREDICTIVE_COL = N'CustomerSegment',
        INPUT = ( Age = 35,
                  Income = 72000,
                  Gender = N'M',
                  PurchasesLastYear = 12 )
    ) AS PredictedSegment;

Remarks

See also

Related topics
Data Mining Models Overview
PREDICTION_PROBABILITY Function
Frequently Used Queries for Mining Models
Deploying Mining Models to Analysis Services