Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow custom key type in argument and result maps #143

Closed
vruusmann opened this issue Feb 10, 2019 · 1 comment
Closed

Allow custom key type in argument and result maps #143

vruusmann opened this issue Feb 10, 2019 · 1 comment

Comments

@vruusmann
Copy link
Member

vruusmann commented Feb 10, 2019

The Evaluator#evaluate(Map) method requires argument and result maps to be keyed using org.dmg.pmml.FieldName type:

Map<FieldName, ?> arguments = ...;
Map<FieldName, ?> results = evaluator.evaluate(arguments);

Most applications employ some other key type (typically java.lang.String) in their data schemas, which necessitates explicit custom key -> org.dmg.pmml.FieldName -> custom key translation.

The explicit key translation could be avoided if the org.jpmml.evaluator.Evaluator interface was generified:

public interface Evaluator <InKey, OutKey> {
  Map<OutKey, ?> evaluate(Map<InKey, ?>);
}

The translation between application-specific key types and the org.dmg.pmml.FieldName type would be handled by configuring appropriate org.jpmml.evaluator.InputMapper and org.jpmml.evaluator.ResultMapper instances.

This is a breaking change, to be implemented in the beginning of the 1.5.X development series.

@vruusmann
Copy link
Member Author

Was addressed in the 1.6.X development branch by changing the key type of argument and result maps from org.dmg.pmml.FieldName to java.lang.String.

String-keyed maps should be much easier to interface with application-specific data records.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant