Java Reference
In-Depth Information
Listing 9-9
Specification of decision tree algorithm settings
1. public static void input() throws JDMException {
2. . . .
3. PhysicalDataSet pds = pdsFactory.create("customers", false);
4. ClassificationSettings cls = clsFactory.create();
5. cls.setTargetAttributeName("Attrite");
6. TreeSettingsFactory treeFactory = (TreeSettingsFactory)dmeConn.getFactory(
7. "javax.datamining.algorithm.tree.TreeSettings");
8. TreeSettings treeSettings = treeFactory.create();
9. treeSettings.setBuildHomogeneityMetric(TreeHomogeneityMetric.gini);
10. treeSettings.setMaxDepth(10);
11. treeSettings.setMinNodeSize(5, SizeUnit.percentage);
12. cls.setAlgorithmSettings(treeSettings);
13. . . .
14. }
9.4.3
Model Contents
After the successful build of the attrition_model it can be retrieved
from the DME to explore its contents. Table 9-12 lists the methods of
the ClassificationModel , SupervisedModel , and Model interfaces. The
inheritance hierarchy of the ClassificationModel is similar to that of the
classification settings discussed in Section 9.4.1. The Model interface is
the base interface for all types of models. It provides the methods to
retrieve model metadata and basic contents. As shown in Table 9-12,
Model has methods for getting the model signature, algorithm-
specific model details, build settings specified by the user, the actual
build settings used by the algorithm, the model build time duration,
and version information.
The SupervisedModel interface is common for all supervised mod-
els, providing the target attribute name used to build the model. The
ClassificationModel interface contains methods to retrieve the target
category set, a flag to indicate whether a cost matrix was used by the
model, and the classification error if computed by the model. Listing
9-10 shows the output method that retrieves the attrition_model and
some of the model metadata and algorithm-specific model details.
JDM defines algorithm-specific model detail interfaces as shown in
Table 9-13.
Listing 9-10 in lines 5 to 12 shows the model signature retrieval
using the Model.getSignature() method that returns the data.ModelSig-
nature object. The model signature contains a collection of data.Signa-
tureAttribute objects that represent the actual attributes used for
model build. Line 14 shows how to get the mining algorithm from
the model, and lines 16 to 58 show the retrieval of model details
Search WWH ::




Custom Search