Java Reference
In-Depth Information
Table 9-10 javax.datamining.supervised.classification.ClassificationSettings
interfaces (continued)
Methods
Description
set/getWeightAttribute(java.lang.String
logicalAttrName)
Used to set/get the name of the attribute that
contains case (record) weights.
verify():VerificationReport
Verifies if the settings are valid to some degree of
correctness as specified by the vendor.
Listing 9-8
ClassificationSettings use
1. public static void input() throws JDMException {
2. . . .
3. cls.setLogicalDataName("attritionBuildLogicalData");
4. //Capital Gain attribute outlier settings
5. cls.setOutlierIdentification("capital_gain", 2000 20000);//TODO How to create
interval object
6. cls.setOutlierTreatment("capital_gain", OutlierTreatment.asMissing);
7. //Attrition prior probabilities settings
8. Map attritionPriors = new HashMap();
9. attritionPriors.put("Attriter", new Double(20.0));//Attrter
10. attritionPriors.put("Non-attriter", new Double(80.0));//Non-attriter
11. //Set Prior Probabilities
12. cls.setPriorProbabilitiesMap("Attrite", attritionPriors);
13. //Create cost matrix
14. CostMatrixFactory cmFactory = (CostMatrixFactory)dmeConn.getFactory(
15. "javax.datamining.supervised.classification.CostMatrix");
16. CategorySet csAttrition = csFactory.create(AttributeDataType.stringType);
17. csAttrition.addCategory("Attriters", CategoryProperty.valid);
18. csAttrition.addCategory("Non-attriters", CategoryProperty.valid);
19. CostMatrix cm = cmFactory.create(csAttrition);
20. cm.setCellValue("Attriters", "Non-attriters", 150);
21. cm.setCellValue("Non-attriters", "Attriters", 50);
22. dmeConn.saveObject("attrition_cost_matrix", cm, true);
23. //Set cost matrix
24. cls.setCostMatrixName("attrition_cost_mMatrix");
25. dmeConn.saveObject( "attrition_build_settings", cls, replaceExistingObject );
26. }
9.4.2
Algorithm Settings
The specification of algorithm settings is optional for JDM applications.
When it is not specified, the DME will select the algorithm, using
either a default algorithm or intelligent selection based on the
nature of the data. However, in vendor implementations that
support algorithms, users can specify algorithm settings to control
the choice of algorithm as well as to fine-tune the resulting model.
Search WWH ::




Custom Search