Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Applies to:
SQL Server 2019 and earlier Analysis Services
Azure Analysis Services
Fabric/Power BI Premium
Important
Data mining was deprecated in SQL Server 2017 Analysis Services and now discontinued in SQL Server 2022 Analysis Services. Documentation is not updated for deprecated and discontinued features. To learn more, see Analysis Services backward compatibility.
In SQL Server SQL Server Analysis Services, modeling flags give a data mining algorithm more information about the data in a case table. The algorithm uses this information to build a more accurate data mining model.
You define some modeling flags at the mining structure level and others at the mining model column level. For example, use the NOT NULL modeling flag with mining structure columns. The algorithm you use to create the model determines which additional modeling flags you can define on mining model columns.
Note
Third-party plug-ins might include modeling flags beyond those that SQL Server Analysis Services defines.
List of modeling flags
SQL Server Analysis Services supports the following modeling flags. For information about flags that specific algorithms support, see the technical reference for the algorithm that creates the model.
NOT NULL
Specifies that the attribute column can't contain null values. During model training, SQL Server Analysis Services returns an error if it encounters a null value in this column.
MODEL_EXISTENCE_ONLY
Treats the column as having two states: Missing and Existing. If the value is NULL, the algorithm treats it as Missing. The MODEL_EXISTENCE_ONLY flag applies to the predictable attribute, and most algorithms support the flag.
When you set the MODEL_EXISTENCE_ONLY flag to True, the model represents values with only two states: Missing and Existing. It combines all nonmissing states into one Existing value.
A typical use for this modeling flag would be in attributes for which the NULL state has an implicit meaning, and the explicit value of the NOT NULL state might not be as important as the fact that the column has any value. For example, a [DateContractSigned] column might be NULL if a contract was never signed and NOT NULL if the contract was signed. Therefore, if the purpose of the model is to predict whether a contract will be signed, you can use the MODEL_EXISTENCE_ONLY flag to ignore the exact date value in the NOT NULL cases and distinguish only between cases where a contract is Missing or Existing.
Note
Missing is a special state used by the algorithm, and differs from the text value "Missing" in a column. For more information, see Missing Values (Analysis Services - Data Mining).
REGRESSOR
The REGRESSOR flag marks the column as a candidate regressor during processing. Use this flag only on a mining model column that has a continuous numeric data type. For more information, see Uses of the REGRESSOR Modeling Flag.
Viewing and Changing Modeling Flags
View the modeling flags for a mining structure column or model column in the structure or model properties in Data Mining Designer.
To check the modeling flags for the current mining structure, query the data mining schema rowset. The following query returns flags for structure columns only.
SELECT COLUMN_NAME, MODELING_FLAG
FROM $system.DMSCHEMA_MINING_STRUCTURE_COLUMNS
WHERE STRUCTURE_NAME = '<structure name>'
You can add or change the modeling flags used in a model by using the Data Mining Designer and editing the properties of the associated columns. Such changes require that the structure or model be reprocessed.
Specify modeling flags in a new mining structure or model by using DMX, AMO, or XMLA scripts. DMX can't change modeling flags in an existing mining model or structure. Instead, create a mining model with ALTER MINING STRUCTURE ... ADD MINING MODEL.
Uses of the REGRESSOR modeling flag
When you set the REGRESSOR modeling flag on a column, you indicate that the column contains potential regressors. The algorithm determines which regressors the model uses and discards any that don't model the predictable attribute.
When you build a model by using the Data Mining wizard, all continuous input columns are flagged as possible regressors. Therefore, even if you don't explicitly set the REGRESSOR flag on a column, the column might be used as a regressor in the model.
You can determine the regressors that were actually used in the processed model by performing a query against the schema rowset for the mining model, as shown in the following example:
SELECT COLUMN_NAME, MODELING_FLAG
FROM $system.DMSCHEMA_MINING_COLUMNS
WHERE MODEL_NAME = '<model name>'
Note After you change a mining column's content type from continuous to discrete, manually change the column's flag and reprocess the model.
Regressors in linear regression models
Linear regression models are based on the Microsoft Decision Trees algorithm. Even if you don't use the Microsoft Linear Regression algorithm, any decision tree model can contain a tree or nodes that represents a regression on a continuous attribute.
Therefore, in these models you don't need to specify that a continuous column represents a regressor. The Microsoft Decision Trees algorithm partitions the dataset into regions with meaningful patterns even if you don't set the REGRESSOR flag on the column. The difference is that when you set the modeling flag, the algorithm tries to find regression equations of the following form to fit the patterns in the nodes of the tree.
a*C1 + b*C2 + ...
The algorithm calculates the sum of the residuals. If the deviation is too great, the algorithm forces a split in the tree.
For example, suppose you predict customer purchasing behavior by using Income as an attribute and set the REGRESSOR modeling flag on the column. The algorithm first tries to fit the Income values to a standard regression formula. If the deviation is too great, the algorithm abandons the formula and splits the tree on another attribute. The algorithm then tries to fit an income regressor in each branch.
Use the FORCE_REGRESSOR parameter to require the algorithm to use a particular regressor. The Decision Trees and Linear Regression algorithms support this parameter.
Related tasks
Use these links to learn more about modeling flags.
| Task | Topic |
|---|---|
| Edit modeling flags in the Data Mining Designer | View or Change Modeling Flags (Data Mining) |
| Specify a hint to the algorithm to recommend likely regressors | Specify a Column to Use as Regressor in a Model |
| See the modeling flags supported by specific algorithms (in the Modeling Flags section for each algorithm reference topic) | Data Mining Algorithms (Analysis Services - Data Mining) |
| Learn more about mining structure columns and the properties that you can set on them | Mining Structure Columns |
| Learn about mining model columns and modeling flags that you can apply at the model level | Mining Model Columns |
| See syntax for working with modeling flags in DMX statements | Modeling Flags (DMX) |
| Learn about missing values and how to work with them | Missing Values (Analysis Services - Data Mining) |
| Learn about managing models and structures and setting usage properties | Moving Data Mining Objects |