use of org.jpmml.sparkml.ItemSetFeature in project jpmml-sparkml by jpmml.
the class FPGrowthModelConverter method getFeatures.
@Override
public List<Feature> getFeatures(SparkMLEncoder encoder) {
FPGrowthModel model = getTransformer();
String itemsCol = model.getItemsCol();
// Convert from plural to singular
if (itemsCol.endsWith("s")) {
itemsCol = itemsCol.substring(0, itemsCol.length() - 1);
}
DataField transactionDataField = encoder.createDataField(FieldName.create("transaction"), OpType.CATEGORICAL, DataType.STRING);
DataField itemDataField = encoder.createDataField(FieldName.create(itemsCol), OpType.CATEGORICAL, DataType.STRING);
Feature feature = new ItemSetFeature(encoder, itemDataField);
return Collections.singletonList(feature);
}
Aggregations