iamDecode / sklearn-pmml-model

A library to parse and convert PMML models into Scikit-learn estimators.
BSD 2-Clause "Simplified" License
76 stars 15 forks source link

the package predict result #56

Open cfkstat opened 2 months ago

cfkstat commented 2 months ago

The predicted result of PMML is different from the structure given by the package. The value accuracy of node nodes of each tree is more different than that of PMML. How to correct the result。

                                <Node score="0.6310734991952227">
                                    <True/>
                                    <Node score="0.4361420248951856">
                                        <SimplePredicate field="x8" operator="greaterThan" value="0.050035"/>
                                        <Node score="0.2931922770751584">
                                            <SimplePredicate field="x21" operator="greaterThan" value="15.870000000000003"/>
                                            <Node score="0.20872197154514233">
                                                <SimplePredicate field="x2" operator="greaterThan" value="17.565"/>
                                            </Node>
                                        </Node>
                                    </Node>
                                    <Node score="0.4198977353701825">
                                        <SimplePredicate field="x21" operator="greaterThan" value="16.715000000000007"/>
                                    </Node>
                                    <Node score="0.5677207700477106">
                                        <SimplePredicate field="x14" operator="greaterThan" value="31.285"/>
                                    </Node>
                                    <Node score="0.6109615216880759">
                                        <SimplePredicate field="x22" operator="greaterThan" value="32.175000000000004"/>
                                    </Node>
                                    <Node score="0.6310734991952227">
                                        <SimplePredicate field="x1" operator="greaterThan" value="12.465000000000002"/>
                                    </Node>

sklearn pmml model

iamDecode commented 2 months ago

Hmm, a likely source of trouble is a mismatch between "<" and "<=" between the model you exported, the pmml file, and sklearn-pmml-model.. However, it is difficult to tell from your example. I do not fully understand how the provided image shows the problem.

Would you be able to provide a more complete example: 1) a code snippet with training the original model, 2) the full pmml file, and optionally 3) a code example showing that the prediction is indeed different between the original model and the pmml?