Java Reference
In-Depth Information
35.
for (int lIdx
0; lIdx
lCount; lIdx
) {
36.
long lTP
lROC.getPositives(lIdx, true);
37.
long lFP
lROC.getPositives(lIdx, false);
38.
double lValue
(lTP * iIndividualProfit) -
39.
(lFP * iIndividualCost);
40.
if (lBestValue
lBestValue) {
41.
lBestValue
lValue;
42.
lBestProba
lROC.getProbabilityThreshold(lIdx);
43.
}
44.
}
45.
if (lModelsBestValue
lBestValue) {
46.
lModelsBestValue
lBestValue;
47.
lModelsBestProba
lBestProba;
48.
lBestModelName
lModelName;
49.
}
50.
}
51.
mBestModelName
lBestModelName;
52.
mBestModelProbaThreshold
lModelsBestProba;
53. }
Then, the selected model will be used to generate the probabilities
associated with each individual customer. To do this, we create the
appropriate
ApplySettings
, asking to generate the probability of being
in the desired category (the
Responded
category). We show how to
apply the model to customers for the large-scale campaign, and
exclude those from the starter campaign. For this, we create an SQL
statement with logic opposite from the one we used for the build
dataset. The following SQL selects the customers for which we do
not have any response during the starter mailing campaign.
select c.*
from CUSTOMERS c left outer join
STARTER_CUSTOMERS sc on c.CUSTOMER_ID
sc.CUSTOMER_ID
where (sc.RESPONSE IS null)
When creating the
ApplyTask
, we specify the name of the dataset
where the scored results, that is, probabilities, are placed. In our
design, these results will be stored in an intermediate table as speci-
fied in the variable
iApplyOutputDataName
with an “_ALL” suffix, as
shown at line 39. This table contains only intermediate results
because we need to filter those customers meeting the probability
threshold requirement. Those customers selected are placed in the
final result dataset named in
iApplyOutputDataName
.
Search WWH ::
Custom Search