Java Reference
In-Depth Information
34. //Create and execute tasks
35. public boolean run() throws JDMException {
36. //Create task object factories
37. btkFactory = (BuildTaskFactory)dmeConn.getFactory(
38. "javax.datamining.task.BuildTask");
39. //Run until completion when timeout is set to null
40. Long timeOut = null;
41. //Create and run build task
42. BuildTask btk = btkFactory.create("ai_build_data",
43. "ai_build_settings", "ai_model");
44. ExecutionStatus buildStatus = dmeConn.execute( btk, timeOut );
45. //If Build task is successful run test metrics task
46. if( ExecutionState.success.equals( buildStatus.getState() ) )
47. return true;
48. else
49. return false;
50. }
51.
52. //Retrieve built model and test metrics
53. public void output() throws JDMException {
54. //Retrieve regression model
55. AttributeImportanceModel ai_model =
56. (AttributeImportanceModel)dmeConn.retrieveObject("ai_model",NamedObject.model);
57. //List attributes in the descending order of importance and display rank and
58. //importance value
59. Collection impAttrs = ai_model.getAttributesByRank(SortOrder.descending);
60. Iterator impAttrsIterator = impAttrs.iterator();
61. SignatureAttribute attr = null;
62. System.out.println("AttributeName Rank Importance Value");
63. while(impAttrsIterator.hasNext()) {
64. attr = (SignatureAttribute)impAttrsIterator.next();
65. String attrName = attr.getName();
66. int rank = attr.getRank();
67. double importanceValue = attr.getImportanceValue();
68. System.out.println(attrName + " " + rank + " " + importanceValue);
69. }
70. }}
9.7
Using Association Interfaces
The javax.datamining.association package contains association function
interfaces, such as AssociationSettings , AssociationModel , Association-
Rule , RulesFilter , etc. JDM defines interfaces to build the association
model and retrieve the contents of the model. The AssociationSettings
interface provides the model settings to control model contents by
filtering criteria such as minimum rule support, confidence, maxi-
mum rule length, and items to be included or excluded. The Associa-
tionModel interface provides methods to retrieve model contents,
such as rules, items, and itemsets, using different types of filters.
 
Search WWH ::




Custom Search