Java Reference
In-Depth Information
users can specify the maximum number of attributes using the
AttributeImportanceSettings.setMaxAttributeCount(int) method. In addi-
tion, after building the model, applications can filter the set of
attributes further, either by the percentage of the important attributes
using AttributeImportanceModel.getAttributesByPercentage(double, Sort
Order) method, or by attribute rank range using the AttributeImpor-
tanceModel.getAttributesByRank(int lowerRank, int upperRank) method.
Lines 55 to 69 show the retrieval of the ai_model that ranks the impor-
tance of the predictor attributes. The get methods of this model return
the collection of SignatureAttribute objects that encapsulates the
attribute details, such as name, type, data type, rank, and importance
value. Lines 64 to 67 show the signature attribute usage.
Listing 9-15
Select important attributes for building attrition_Model
1. public class SelectImportantAttributes {
2. //Data members
3. . . .
4. static AttributeImportanceSettingsFactory aiSettingsFactory = null;
5. . . .
6. //Main method
7. public static void main(String args[]) throws Exception {
8. try {
9. //Create DME connection as shown in Listing 9.1 or 9.2
10. // . . .
11. input(); //Create input objects
12. if( run() ) //Execute model build task
13. output(); //Retrieve the model
14. } catch(Exception anyFailures) { anyFailures.printStackTrace();
15. } finally { if(dmeConn != null) dmeConn.close(); //Close connection
16. }}
17.
18. //Create and save input objects
19. public static void input() throws JDMException {
20. //Create Input object factories
21. . . .
22. aiSettingsFactory = (AttributeImportanceSettingsFactory)dmeConn.getFactory(
23. "javax.datamining.attributeimportance.AttributeImportanceSettings");
24.
25. boolean replaceObject = true;
26. //Input objects for building appraisal_model using appraisal_build_data dataset
27. PhysicalDataSet pdsBuild = pdsFactory.create( "customers", false );
28. AttributeImportanceSettings aiSettings = aiSettingsFactory.create();
29. aiSettings.setTargetAttributeName("attrite");
30. dmeConn.saveObject( "ai_build_data", pdsBuild, replaceObject);
31. dmeConn.saveObject( "ai_builds_settings", aiSettings, replaceObject);
32. }
33.
Search WWH ::




Custom Search