Database Reference
In-Depth Information
The basis transformations of categorical attributes can be embedded into the
basis transformation of MiningDataSpecification for all categorical attributes
included. This results in comfortable nested basis transformation. Caching is used
for all metadata and categorical attribute basis transformations. The resulting nested
caching ensures the high speed required for basis transformations.
Example 12.7 Again we consider the basis meal from Example 12.4 and demon-
strate the basis transformation from a second basis meal2 into meal .
// -------- Create new metadata 'meal2' ---------
// Create 'cutlery2' attribute with one new category and new
order:
CategoricalAttribute cutlery2 ¼ new CategoricalAttribute
("cutlery");
cutlery2.addCategory( new Category("spoon") );
cutlery2.addCategory( new Category("knife") );
cutlery2.addCategory( new Category("skewer") );
cutlery2.addCategory( new Category("fork") );
// Create new numeric attribute 'price':
NumericAttribute price ¼ new NumericAttribute("price");
// Create new metadata 'meal2':
MiningDataSpecification meal2 ¼ new MiningDataSpecification
("meal2");
meal2.addMiningAttribute( cutlery2 );
meal2.addMiningAttribute( numberOfGuests );
meal2.addMiningAttribute( price );
meal2.addMiningAttribute( calories );
// ------- Get basis trafo object of 'meal' -------
MetaDataOperations mealOp ¼ meal.getMetaDataOp();
mealOp.setUsageType(
MetaDataOperations.USE_ATT_NAMES_AND_TYPES_AND_
CATEGORIES);
// ------- Compare bases 'meal' and 'meal2' -------
System.out.println("'meal' ¼¼ 'meal2': " +
mealOp.equals(meal2) ); // false
System.out.println("'meal' subset 'meal2': " +
mealOp.subset(meal2) ); // true
System.out.println("'meal' superset 'meal2': " +
mealOp.superset(meal2) ); // false
// ------ Transforms basis of 'meal2' into 'meal' -----
MiningDataSpecification transMeal2
¼
mealOp.transform
(meal2);
System.out.println("transformed 'meal2': " + transMeal2);
Search WWH ::




Custom Search