mleap icon indicating copy to clipboard operation
mleap copied to clipboard

Java examples for scoring

Open mengxr opened this issue 7 years ago • 7 comments

Many users can only use Java in a production environment. It would be nice if we can provide an example project for scoring in Java. I saw some Java interfaces at https://github.com/combust/mleap/tree/master/mleap-runtime/src/main/java/ml/combust/mleap/runtime/javadsl. But no public doc/example mentioned them.

mengxr avatar Jun 20 '18 17:06 mengxr

Hey @mengxr,

We'll work to add some examples in the doc, but for now, you can check out this toy project that shows how to use mleap-runtime within a spring boot Java service: https://github.com/ancasarb/mleap-scoring-spring-boot

We're also working on some grpc and springboot scoring services in this branch that we'd like to merge soon: https://github.com/combust/mleap/tree/feature/mleap-grpc

Let me know if you have any questions!

ancasarb avatar Jun 27 '18 12:06 ancasarb

Amazon SageMaker has also developed a fully Java based serving setup powered by mleap-runtime. You can find the code here - https://github.com/aws/sagemaker-sparkml-serving-container.

MLeap provided Java interface is nice and it didn't require us to write any Scala code (barring the use of JavaConverters from Scala library) while developing this.

orchidmajumder avatar Nov 29 '18 17:11 orchidmajumder

@ancasarb I am not able to access any of the links which you have added. (Unfortunate 404 errors). I am also looking for mleap java prediction/scoring examples.

jainakshay2605 avatar Feb 19 '19 00:02 jainakshay2605

hey @jainakshay2605, sorry about that, I'm not too sure what happened to that project. You can also take a look at the unit tests in JavaDSLSpec.java which shows you how you can do various things from creating a leap frame, tensor types, row transformers, transform a leap frame etc. The most comprehensive test is this one https://github.com/combust/mleap/blob/master/mleap-runtime/src/test/scala/ml/combust/mleap/runtime/javadsl/JavaDSLSpec.java#L143, which saves a bundle to a file, loads it back in and then transformers a leap frame with the loaded bundle.

ancasarb avatar Mar 03 '19 15:03 ancasarb

Hi @jainakshay2605 you can take a look at an example here how MLeap can be used from Java - https://github.com/aws/sagemaker-sparkml-serving-container. I used the repository of @ancasarb as an example for writing this.

orchidmajumder avatar Mar 07 '19 00:03 orchidmajumder

I found the MLeap serving doc (http://mleap-docs.combust.ml/mleap-serving/) really helpful for scoring. the page doesn't talk about how to call via Java. but there are pages on the website that talk about how to construct the input leapframe

prashant-shetty-sp avatar Sep 13 '19 15:09 prashant-shetty-sp

Just curious if there was any update on this topic of having Java examples in the documentation. Thanks.

mathfish avatar Jun 04 '20 13:06 mathfish