Java Code Examples for org.jpmml.converter.TypeUtil#getDataType()

The following examples show how to use org.jpmml.converter.TypeUtil#getDataType() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DiscreteDomain.java    From jpmml-sklearn with GNU Affero General Public License v3.0 6 votes vote down vote up
@Override
public DataType getDataType(){
	Object dtype = getDType();
	Boolean withData = getWithData();

	if(dtype != null){
		return TransformerUtil.getDataType(dtype);
	} // End if

	if(withData){
		List<?> data = getData();

		return TypeUtil.getDataType(data, DataType.STRING);
	}

	return DataType.STRING;
}
 
Example 2
Source File: OrdinalEncoder.java    From jpmml-sklearn with GNU Affero General Public License v3.0 5 votes vote down vote up
@Override
public DataType getDataType(){
	List<List<?>> categories = getCategories();

	DataType result = null;

	for(int i = 0; i < categories.size(); i++){
		List<?> featureCategories = categories.get(i);

		DataType dataType = TypeUtil.getDataType(featureCategories, null);

		if(result == null){
			result = dataType;
		} else

		{
			if(!(result).equals(dataType)){
				throw new UnsupportedOperationException();
			}
		}
	}

	if(result == null){
		result = DataType.STRING;
	}

	return result;
}
 
Example 3
Source File: LookupTransformer.java    From jpmml-sklearn with GNU Affero General Public License v3.0 5 votes vote down vote up
@Override
public DataType getDataType(){
	Map<?, ?> mapping = getMapping();

	List<Object> inputValues = new ArrayList<>(mapping.keySet());

	return TypeUtil.getDataType(inputValues, DataType.STRING);
}
 
Example 4
Source File: RExpEncoder.java    From jpmml-r with GNU Affero General Public License v3.0 5 votes vote down vote up
@Override
public DataField createDataField(FieldName name, OpType opType, DataType dataType, List<?> values){

	if(dataType == null){
		dataType = TypeUtil.getDataType(values);
	}

	return super.createDataField(name, opType, dataType, values);
}
 
Example 5
Source File: LabelEncoder.java    From jpmml-sklearn with GNU Affero General Public License v3.0 4 votes vote down vote up
@Override
public DataType getDataType(){
	List<?> classes = getClasses();

	return TypeUtil.getDataType(classes, DataType.STRING);
}
 
Example 6
Source File: OneHotEncoder.java    From jpmml-sklearn with GNU Affero General Public License v3.0 4 votes vote down vote up
@Override
public DataType getDataType(){
	List<? extends Number> values = getValues();

	return TypeUtil.getDataType(values, DataType.INTEGER);
}
 
Example 7
Source File: LabelBinarizer.java    From jpmml-sklearn with GNU Affero General Public License v3.0 4 votes vote down vote up
@Override
public DataType getDataType(){
	List<?> classes = getClasses();

	return TypeUtil.getDataType(classes, DataType.STRING);
}