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

XGBoostRegressor not loading in java #171

Closed
matigurten opened this issue Oct 6, 2019 · 1 comment
Closed

XGBoostRegressor not loading in java #171

matigurten opened this issue Oct 6, 2019 · 1 comment

Comments

@matigurten
Copy link

matigurten commented Oct 6, 2019

I created a XGBoostRegressor model in python and converted it using xgboost_to_pmml from nyoka, resulting in a PMML (version 4.4, then manually downgraded to 4.3 for java compatibility) file that ends in smth like this:

    <MiningModel modelName="XGBoostModel" functionName="regression">
        <MiningSchema>
            <MiningField name="x1" usageType="active" optype="continuous"/>
            <MiningField name="x2" usageType="active" optype="continuous"/>
            <MiningField name="x3" usageType="active" optype="continuous"/>
            <MiningField name="x4" usageType="active" optype="continuous"/>
            <MiningField name="prediction" usageType="target" optype="continuous"/>
        </MiningSchema>
        <Output>
            <OutputField name="predicted_prediction" optype="continuous" dataType="double" feature="predictedValue"/>
        </Output>
        <Segmentation multipleModelMethod="sum" missingThreshold="1"/>
    </MiningModel>
</PMML>

But when i try to create a MiningModelEvaluator in java, with this PMML I get the following error:

org.jpmml.evaluator.MissingElementException (at or around line 95 of the PMML document): Required element Segmentation/Segment is not defined

Line 95 is the one that reads <Segmentation multipleModelMethod="sum" missingThreshold="1"/>

Please help, thanks a lot!

@vruusmann
Copy link
Member

I created a XGBoostRegressor model in python and converted it using xgboost_to_pmml from nyoka,

Please consider using the sklearn2pmml package instead.

org.jpmml.evaluator.MissingElementException (at or around line 95 of the PMML document): Required element Segmentation/Segment is not defined

The JPMML-Evaluator library is right when making this complaint, because you have an empty Segmentation element on line 95.

The PMML specification requires it to contain at least one Segment child element, see http://dmg.org/pmml/v4-3/MultipleModels.html#xsdElement_Segmentation

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

2 participants