IsTrainingCase (DMX)

APPLIES TO:yesSQL Server Analysis ServicesnoAzure Analysis Services

Indicates whether a case is used as a training case for the specified data mining model or mining structure.



Result Type

Returns true if the case is a part of the training data set; otherwise false.


If you use the Data Mining Wizard to create a mining structure and related mining model, by default, 30 percent of the cases are set aside for use as a test data set. The remaining cases in the data source that you specify are used to train the model. However, if you use Data Mining Extensions (DMX) to create the mining model, by default, all data is used to train the model, and no test set is created. To enable the creation of a test data set, you must set the parameters of the WITH HOLDOUT clause.

You can determine whether the data in a particular data mining structure has been partitioned into testing and training sets by viewing the value of the HoldoutMaxCases and HoldoutMaxPercent properties.


Drillthrough must be enabled on the model if you want to use the IsTrainingCase or IsTestCase functions to return details about the cases in the model. For more information, see Enable Drillthrough for a Mining Model.

To return cases that are part of the test data set, use the function IsTestCase (DMX).


The following example uses the clustering data mining model from the targeted mailing scenario in the Basic Data Mining Tutorial. The query returns only those cases that were used for training the mining model. Moreover, the training cases are restricted to customers younger than 40.

FROM [TM Clustering].CASES  
WHERE IsTrainingCase()  
AND [Age] <40  

For other examples of how to query cases used in data mining, see SELECT FROM <model>.CASES (DMX) and SELECT FROM <structure>.CASES.

See Also

Training and Testing Data Sets
Functions (DMX)
Data Mining Queries