jpmml / jpmml-sklearn

Java library and command-line application for converting Scikit-Learn pipelines to PMML
GNU Affero General Public License v3.0
531 stars 117 forks source link

convert error #112

Closed sin-en-2009 closed 5 years ago

sin-en-2009 commented 5 years ago

When I used dataframemapper for feature engineering and set the default to None, after generating the model file, I used the command to convert the model file and reported the following error Isn't there support for the conversion of dataframemapper to none by default?

java.lang.IllegalArgumentException: Attribute 'sklearn_pandas.dataframe_mapper.D
ataFrameMapper.default' has a missing (None/null) value
        at org.jpmml.sklearn.PyClassDict.get(PyClassDict.java:46)
        at org.jpmml.sklearn.PyClassDict.getObject(PyClassDict.java:97)
        at sklearn_pandas.DataFrameMapper.getDefault(DataFrameMapper.java:97)
        at sklearn_pandas.DataFrameMapper.initializeFeatures(DataFrameMapper.jav
a:47)
        at sklearn.Initializer.encodeFeatures(Initializer.java:41)
        at sklearn.Transformer.updateAndEncodeFeatures(Transformer.java:85)
        at sklearn.pipeline.Pipeline.encodeFeatures(Pipeline.java:79)
        at sklearn2pmml.pipeline.PMMLPipeline.encodePMML(PMMLPipeline.java:203)
        at org.jpmml.sklearn.Main.run(Main.java:145)
        at org.jpmml.sklearn.Main.main(Main.java:94)
vruusmann commented 5 years ago

Isn't there support for the conversion of dataframemapper to none by default?

The construct DdataFrameMapper([...], default = None) cannot be supported, because in that case the DFM object does not contain all information that are needed for the PMML conversion to succeed.

If you're interested in dropping columns, then please consider using sklearn.compose.ColumnTransformer([], remainder = "drop") instead.

sin-en-2009 commented 5 years ago

thanks!