Code Monkey home page Code Monkey logo

Comments (9)

jwgwalton avatar jwgwalton commented on May 14, 2024

@vruusmann hopefully you'll be able to help me. I generated PMML files for the models in the jpmml-lightgbm package to compare to my model and some of them contain "transformedLgbmValue". I'm however struggling to get this to work with the openscoring-service. Any help would be much appreciated cheers.

from openscoring.

vruusmann avatar vruusmann commented on May 14, 2024

It's interesting that the same (and possibly very major) issue gets reported twice by two different people in such a short timeframe.

Issue 47 is about XGBoost, whereas this issue is about LightGBM. However, the exception condition is exactly the same - the second stage of a GBT model (a RegressionModel element that performs the logit transformation) thinks that the first stage of the GBT model (a MiningModel element) returned a missing value as a prediction.

This issue provides a fully reproducible example, so I can observe this exceptional behaviour myself - thanks for that!

I'm puzzled right now. In most cases this exception means that the first stage of the GBT model was executed with incomplete input. But I can see that in this case the argument data record is complete (contains values for all seven input fields).

from openscoring.

vruusmann avatar vruusmann commented on May 14, 2024

The most puzzling part for me is that if I download the latest 1.4.8 release of the JPMML-Evaluator command-line application, and convert the JSON request to a CSV file request, then the prediction succeeds without problem:

$ java -jar pmml-evaluator-example-executable-1.4.8.jar --model lightgbm.pmml --input input.csv --output output.csv

If there was a problem with the PMML file, or the 1.4.8 version of the JPMML-Evaluator library, then the above execution should fail with the same org.jpmml.evaluator.MissingFieldException: Field "transformedLgbmValue" is not defined message. But the prediction is successful - this suggests that there's something wrong with the Openscoring REST web service layer.

input.csv.txt
output.csv.txt

It's worth pointing out that issue 47 reports that the latest 1.4.X release of Openscoring works fine. It's the 2.0-SNAPSHOT codebase (ie. git clone) that is broken.

from openscoring.

vruusmann avatar vruusmann commented on May 14, 2024

On line 60 of the example lightgbm.pmml.txt file there is the following OutputField element declaration:

<OutputField name="transformedLgbmValue" optype="continuous" dataType="double" feature="transformedValue" isFinalResult="false">

If the value of the OutputField@isFinalResult attribute is changed from false to true, then the scoring works fine:

<OutputField name="transformedLgbmValue" optype="continuous" dataType="double" feature="transformedValue" isFinalResult="true">

This attribute value was toggled in one of the latest JPMML-LightGBM (as well as JPMML-XGBoost) releases. Both false and true values are valid in that location. However, looks like that Openscoring is using an output field filtering strategy, which is pruning non-final output field values a bit too aggressively.

from openscoring.

xiaoluoyfy avatar xiaoluoyfy commented on May 14, 2024

@vruusmann so the current solution is to modify the xgb/lgb pmml file manually?

from openscoring.

jwgwalton avatar jwgwalton commented on May 14, 2024

Cheers @vruusmann

from openscoring.

sam-s avatar sam-s commented on May 14, 2024

I am getting Field "expDecisionFunction(0)" is not defined for an iris.pmml created from GradientBoostingClassifier by sklearn2pmml.
Is this related or should I create a separate issue?

from openscoring.

vruusmann avatar vruusmann commented on May 14, 2024

@sam-s If you're absolutely sure that your input data record is complete (ie. there are no missing/omitted) values, then it's the same thing

from openscoring.

vruusmann avatar vruusmann commented on May 14, 2024

It's possible to disable output field filtering by commenting out this line (invocation of ModelEvaluatorBuilder#setOutputFilter(OutputFilters.KEEP_FINAL_RESULTS)):
https://github.com/openscoring/openscoring/blob/master/openscoring-service/src/main/java/org/openscoring/service/Openscoring.java#L195

This issue only affects the WIP codebase. If you've bothered to build a WIP version manually, then my recommendation is that you should comment out the above line, and rebuild.

from openscoring.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.