Predicting the non-majority state

The Predict() function in DMX always returns the highest probability non-missing (by default) state for the requested attribute. That is, if there are two states, the state with a probability higher than 50% will be returned. However in many cases you want a response to be a target state even though it may not have the highest probability. For instance, say you implemented the AdventureWorks Bike Buyer model, and your profit chart indicates you will recieve the highest profit by selecting all the cases where the probability of "Buy" is greater than 25%. Given the processes in place, you don't want to have a filtered result, rather you want to label each row in a table as a target or not.

Luckily, the flexibility of DMX makes this operation quite easy. All that has to be done is to express the condition that represents targets as a boolean expression, and place the expression in the select list. For example, in this case you could use the following query:

SELECT t.CustomerID, (PredictProbability([Bike Buyer],'Buy') > 0.25) AS IsTarget FROM MyModel PREDICTION JOIN ...

The expression PredictProbability([Bike Buyer],'Buy') > 0.25 evaluates to a boolean and is returned as IsTarget. Using this statement would tag cases as targets even though they have up to a 75% chance not to buy, since your tests showed that group to be the most profitable.