Search in sources :

Example 1 with WildcardFeature

use of org.jpmml.converter.WildcardFeature in project jpmml-sparkml by jpmml.

the class SparkMLEncoder method getFeatures.

public List<Feature> getFeatures(String column) {
    List<Feature> features = this.columnFeatures.get(column);
    if (features == null) {
        FieldName name = FieldName.create(column);
        DataField dataField = getDataField(name);
        if (dataField == null) {
            dataField = createDataField(name);
        }
        Feature feature;
        DataType dataType = dataField.getDataType();
        switch(dataType) {
            case STRING:
                feature = new WildcardFeature(this, dataField);
                break;
            case INTEGER:
            case DOUBLE:
                feature = new ContinuousFeature(this, dataField);
                break;
            case BOOLEAN:
                feature = new BooleanFeature(this, dataField);
                break;
            default:
                throw new IllegalArgumentException("Data type " + dataType + " is not supported");
        }
        return Collections.singletonList(feature);
    }
    return features;
}
Also used : ContinuousFeature(org.jpmml.converter.ContinuousFeature) DataField(org.dmg.pmml.DataField) DataType(org.dmg.pmml.DataType) Feature(org.jpmml.converter.Feature) ContinuousFeature(org.jpmml.converter.ContinuousFeature) BooleanFeature(org.jpmml.converter.BooleanFeature) WildcardFeature(org.jpmml.converter.WildcardFeature) FieldName(org.dmg.pmml.FieldName) BooleanFeature(org.jpmml.converter.BooleanFeature) WildcardFeature(org.jpmml.converter.WildcardFeature)

Aggregations

DataField (org.dmg.pmml.DataField)1 DataType (org.dmg.pmml.DataType)1 FieldName (org.dmg.pmml.FieldName)1 BooleanFeature (org.jpmml.converter.BooleanFeature)1 ContinuousFeature (org.jpmml.converter.ContinuousFeature)1 Feature (org.jpmml.converter.Feature)1 WildcardFeature (org.jpmml.converter.WildcardFeature)1