-
Notifications
You must be signed in to change notification settings - Fork 113
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
API for customizing OutputField
names
#361
Comments
Hello! More specifically I am trying to load the model in java using this library and I cannot find a way to get the names.
Any example link you could share would be helpful. |
See https://github.com/jpmml/jpmml-evaluator#querying-the-data-schema-of-models
Renaming active and target fields is straightforward - just initialize your Renaming output fields will be addressed by this issue. Right now they are generated using fairly reasonable patterns (eg. all probability outputs are named There's also a distinct category of fields called "derived fields", which correspond to Scikit-Learn transformer objects. They are named after Scikit-Learn class names by default (eg. a |
If you have any field naming questions - backed by concrete Scikit-Learn/Python code snippets - please ask them here. Will do my best to answer them, and maybe it will give me some new ideas for designing a better fix for this issue. Once this issue is resolved, I'll hope to do a quick overview in the form of a small technical article at https://openscoring.io/blog/ |
OutputField
names
Currently doable using the Model Customization API: from sklearn2pmml.util.pmml import make_element
pipeline = PMMLPipeline([...])
pipeline.fit(X, y)
# Define a "skeletal" PMML element, which defines changeable attributes.
# Here, only the OutputField@name attribute will be changed, all other attributes will remain as-is
updated_output_field = make_element("OutputField", name = "p(0)")
# Point the update action towards the existing OutputField element that is named "probability(0)"
pipeline.customize(command = "update", xpath_expr = "//:OutputField[@name='probability(0)']", pmml_element = updated_output_field.tostring().decode("utf-8")) |
Inspired by this (again!):
#359
There should be a Python-accessible API for instructing the PMML conversion engine to override default field names with user-specified field names.
The
Alias
decorator typically creates a copy of the field. As a result, the PMML model schema will contain both the old "badly named" field declaration, plus the new "well named" field declaration. This is confusing for model end users.I'm thinking about some
PMMLPipeline
-level attribute, which could be set using a convenience method:The exported PMML file would contain only "proba_no" and "proba_yes" fields.
The text was updated successfully, but these errors were encountered: