Database Reference
In-Depth Information
a set of real numbers and allows reducing the handling of categories to that of
real values.
Example 12.2
// Create categorical attribute 'cutlery':
CategoricalAttribute cutlery
¼
new CategoricalAttribute
("cutlery");
// Add categories:
Category catFork
¼
new Category("fork"); // new fork
category
cutlery.addCategory( catKnife );
// from previous example
cutlery.addCategory( catFork );
cutlery.addCategory( new Category("spoon") );
// Show key-value relationship:
double keyKnife
¼
cutlery.getKey( catKnife );
Category catKnife2
¼
cutlery.getCategory( keyKnife );
// catKnife
¼¼
catKnife2
■
XELOPES actively supports three storage types of categorical attributes:
•
Static category set
(default): All categories are known a priori. Examples are sex
(female, male) or colors (red, green, blue).
•
Dynamic category set
: During the data processing, new categories may appear
and are added to the basis (option
unboundedCategories
). Examples are item or
category names.
•
Dynamic category set with one category
: During the data processing, only the
current category is stored (option
unstoredCategories
, implies
unboundedCa-
tegories
). Examples are transaction IDs and customer names.
Of course, the proper use of the storage types for the given examples can also
differ. We emphasize that the support of the
unboundedCategories
and
unstored-
Categories
types is really complicated - especially in the field of basis transforma-
tions - but very valuable since it allows to handle large and live data sources.
Categorical attributes with a defined order of categories are modeled by the class
OrdinalAttribute
which extends
CategoricalAttribute
.
Further, the categories of a categorical attribute can be organized into a hierar-
chy (also referred to as taxonomy). This is, e.g., required for many basket analysis
algorithms or, in an extended form, for multilevel methods as in Chap.
6
. Hierar-
chies of categories are modeled by the class
CategoryHierarchy
and can be
assigned to a categorical attribute.
CategoryHierarchy
uses the method
addRelationship
to add a new edge to the hierarchy graph, and many methods
allow running calculations on the graph.