Java Reference
In-Depth Information
logical attributes to inactive, and then the attributes provided as
input arguments are set to active at lines 50 to 52. Once this operation
is completed, the ClassificationSettings object is saved.
Finally, we create the BuildTask to associate the build settings, the
build dataset, and the user-specified model name at line 61. This task
is verified at line 67 and saved in the mining object repository (MOR)
at line 72, and then executed at line 73. Upon successful execution of
this build task, a model with the specified name can then be used for
scoring.
Some advanced users could write equivalent methods to specifi-
cally build a decision tree or a neural network. All these models will
be remembered by their names in the campaign optimization object.
The next section shows that it is possible to compare models to select
the best.
The following code assumes that the JDM implementation can
build a model on “unprepared” data, as described in Chapter 7. If the
JDM implementation requires data preparation, some specific code
will have to be included to perform this preparation.
1. public void buildModel(String iModelName, Collection iActiveAttributes)
2. throws JDMException, InterruptedException {
3. String lDataSetName iModelName "_DS";
4. String lBuildDataSQLStatement buildSQLStatement();
5. mBuildDataSQL lBuildDataSQLStatement;
6. PhysicalDataSetFactory lPdsFactory
7. (PhysicalDataSetFactory) mJDMConnection.getFactory(
8. "javax.datamining.data.PhysicalDataSet");
9. String lDataSetURI getVendorDatasetURI(lBuildDataSQLStatement);
10. PhysicalDataSet lBuildData lPdsFactory.create(lDataSetURI, false);
11. lBuildData.importMetaData();
12. PhysicalAttribute lAttr
13. lBuildData.getAttribute(mIdentifierColumnName.toUpperCase());
14. lAttr.setRole(PhysicalAttributeRole.caseId);
15. mJDMConnection.saveObject(lDataSetName, lBuildData, true);
16. LogicalDataFactory lLDFactory
17. (LogicalDataFactory) mJDMConnection.getFactory(
18. "javax.datamining.data.LogicalData");
19. LogicalData lLogdata lLDFactory.create(lBuildData);
20. String lLogicalDataName iModelName "_LD";
21. if (0 iActiveAttributes.size())
22. {
23. mJDMConnection.saveObject(lLogicalDataName,
24. lLogdata,
25. true);
 
Search WWH ::




Custom Search