Code Monkey home page Code Monkey logo

Comments (3)

vruusmann avatar vruusmann commented on August 11, 2024

Noted.

This fix would make a metadata-level connection between these two DataFrame objects:
https://github.com/jpmml/jpmml-evaluator-python/blob/0.10.1/jpmml_evaluator/__init__.py#L164
https://github.com/jpmml/jpmml-evaluator-python/blob/0.10.1/jpmml_evaluator/__init__.py#L175

Most ML models perform a 1-to-1 mapping (ie. one row of input produces one row of output). But it wouldn't hurt to have a quick check about this assumption, and fall back to a default numbering of output rows if it's being violated.

from jpmml-evaluator-python.

terr01 avatar terr01 commented on August 11, 2024

Thanks. Shouldn't there be a meta-level connection between these two objects? i.e.

evaluateAll(df) shouldBeSameAs df.apply(lambda row: evaluate(row), axis=1) #probably with result_type = "expand"

This connection would break if df can be split into one or more groups and the predictions for each group are based on that group's data as a whole. But this (and others such) seems like entirely different use-case that probably deserves its own function.

from jpmml-evaluator-python.

vruusmann avatar vruusmann commented on August 11, 2024

evaluateAll(df) shouldBeSameAs df.apply(lambda row: evaluate(row), axis=1)

The evaluateAll(df) method call involves exactly one Python-Java-Python roundtrip, because all data is sent over in one go (as a dict data structure). If you replace it with elementary evaluate(X) method calls, then there will be many Python-Java-Python roundtrips (one for each data frame row).

It is my guesstimate that the computational cost of Python-Java-Python rountrip could be comparable to the cost of the actual model evaluation work. So, by limiting the number of roundtrips, I'm expecting to get more "useful" work done per unit of time.

For reference, here's the mechanics of a Python-Java-Python roundtrip:

  1. In Python, dump arguments in pickle data format to a pickle blob (byte array).
  2. Send the pickle blob from Python to Java.
  3. In Java, load arguments from pickle blob.
  4. In Java, perform model evaluation.
  5. In Java, dump results in pickle data format to a pickle blob.
  6. Send the pickle blob from Java to Python.
  7. In Python, load results from pickle blob.

from jpmml-evaluator-python.

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.