Java Reference
In-Depth Information
product recommendation example), and one will be used as a target
(
class
). Setting the
usage
to
active
is shown at lines 9, 17, 25, and 34.
The second option we use is outlier treatment, which is set at lines 6,
15, 23, and 32. We have chosen, in this example, to let the system
decide the treatment for
education
and
marital-status
but to leave the
capital-gain
“as is.” Of course, more general code can be written,
especially in conjunction with a user interface, to ask for attribute
names, together with outlier treatment, usage, and others that can
be tuned at the logical attribute level.
1. protected static BuildAttribute[] createBuildAttributes() {
2. BuildAttribute[] lBuildAttributes
new BuildAttribute[4];
3. BuildAttribute lBuildAttribute
new BuildAttribute();
4. lBuildAttribute.setAttributeName("education");
5. OutlierTreatment lOutlierTreatment
6. new OutlierTreatment(OutlierTreatmentStd.systemDetermined);
7. lBuildAttribute.setOutlierTreatment(lOutlierTreatment);
8. LogicalAttributeUsage lUsage
9.
new LogicalAttributeUsage(LogicalAttributeUsageStd.active);
10. lBuildAttribute.setUsage(lUsage);
11. lBuildAttributes[0]
lBuildAttribute;
12.
13. 1BuildAttribute
new BuildAttribute();
14. lBuildAttribute.setAttributeName("marital-status");
15. lOutlierTreatment
new OutlierTreatment(OutlierTreatmentStd.systemDetermined);
16. lBuildAttribute.setOutlierTreatment(lOutlierTreatment);
17. lUsage
new LogicalAttributeUsage(LogicalAttributeUsageStd.active);
18. lBuildAttribute.setUsage(lUsage);
19. lBuildAttributes[1]
lBuildAttribute;
20.
21. lBuildAttribute
new BuildAttribute();
22. lBuildAttribute.setAttributeName("capital-gain");
23. lOutlierTreatment
new OutlierTreatment(OutlierTreatmentStd.asIs);
24. lBuildAttribute.setOutlierTreatment(lOutlierTreatment);
25. lUsage
new LogicalAttributeUsage(LogicalAttributeUsageStd.active);
26. lBuildAttribute.setUsage(lUsage);
27. lBuildAttributes[2]
lBuildAttribute;
28.
30. lBuildAttribute
new BuildAttribute();
31. lBuildAttribute.setAttributeName("class");
32. lOutlierTreatment
new OutlierTreatment(OutlierTreatmentStd.systemDetermined);
33. lBuildAttribute.setOutlierTreatment(lOutlierTreatment);
34. lUsage
new LogicalAttributeUsage(LogicalAttributeUsageStd.active);
35. lBuildAttribute.setUsage(lUsage);
36. lBuildAttributes[3]
lBuildAttribute;
37.
38. return lBuildAttributes;
39. }
Search WWH ::
Custom Search