使用jpmml

时间:2016-03-10 12:55:21

标签: pmml

使用带有jpmml(版本1.1.16)的树模型时是否存在大小限制?

当我有一个额外的大树(PMML大小为数百MB,数百万个叶子)用于某些输入时,我得到了这个例外:

  

显示java.lang.NullPointerException           在org.jpmml.evaluator.PredicateUtil.evaluateSimplePredicate(PredicateUtil.java:79)           在org.jpmml.evaluator.PredicateUtil.evaluate(PredicateUtil.java:54)           at org.jpmml.evaluator.TreeModelEvaluator.evaluateNode(TreeModelEvaluator.java:171)           at org.jpmml.evaluator.TreeModelEvaluator.handleTrue(TreeModelEvaluator.java:186)           at org.jpmml.evaluator.TreeModelEvaluator.handleTrue(TreeModelEvaluator.java:197)           at org.jpmml.evaluator.TreeModelEvaluator.handleTrue(TreeModelEvaluator.java:197)           在org.jpmml.evaluator.TreeModelEvaluator.evaluateTree(TreeModelEvaluator.java:139)           在org.jpmml.evaluator.TreeModelEvaluator.evaluateRegression(TreeModelEvaluator.java:94)           at org.jpmml.evaluator.TreeModelEvaluator.evaluate(TreeModelEvaluator.java:77)           在org.jpmml.evaluator.MiningModelEvaluator.evaluateSegmentation(MiningModelEvaluator.java:463)           at org.jpmml.evaluator.MiningModelEvaluator.evaluateRegression(MiningModelEvaluator.java:149)           在org.jpmml.evaluator.MiningModelEvaluator.evaluate(MiningModelEvaluator.java:130)           在org.jpmml.evaluator.MiningModelEvaluator.evaluate(MiningModelEvaluator.java:106)           at org.jpmml.evaluator.ModelEvaluator.evaluate(ModelEvaluator.java:263)           在org.openscoring.service.ModelResource.evaluate(ModelResource.java:550)           在org.openscoring.service.ModelResource.doEvaluate(ModelResource.java:404)           在org.openscoring.service.ModelResource.doEvaluateCsv(ModelResource.java:339)           在org.openscoring.service.ModelResource.evaluateCsv(ModelResource.java:299)           at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)           at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)           at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)           at java.lang.reflect.Method.invoke(Unknown Source)           at org.glassfish.jersey.server.model.internal.ResourceMethodInvocationHandlerFactory $ 1.invoke(ResourceMethodInvocationHandlerFactory.java:81)           at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher $ 1.run(AbstractJavaResourceMethodDispatcher.java:143)           at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.invoke(AbstractJavaResourceMethodDispatcher.java:160)           at org.glassfish.jersey.server.model.internal.JavaResourceMethodDispatcherProvider $ ResponseOutInvoker.doDispatch(JavaResourceMethodDispatcherProvider.java:158)           at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.dispatch(AbstractJavaResourceMethodDispatcher.java:97)           在org.glassfish.jersey.server.model.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:389)           在org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:347)           在org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:102)           在org.glassfish.jersey.server.ServerRuntime $ 2.run(ServerRuntime.java:303)           在org.glassfish.jersey.internal.Errors $ 1.call(Errors.java:271)           在org.glassfish.jersey.internal.Errors $ 1.call(Errors.java:267)           在org.glassfish.jersey.internal.Errors.process(Errors.java:315)           在org.glassfish.jersey.internal.Errors.process(Errors.java:297)           在org.glassfish.jersey.internal.Errors.process(Errors.java:267)           在org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:317)           在org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:286)           在org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:1072)           在org.glassfish.jersey.servlet.WebComponent.service(WebComponent.java:399)           在org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:381)           在org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:344)           在org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:221)           在org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:808)           在org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:587)           at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1127)           在org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:515)           at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1061)           在org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)           at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:215)           在org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97)           在org.eclipse.jetty.server.Server.handle(Server.java:497)           在org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:310)           在org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:257)           在org.eclipse.jetty.io.AbstractConnection $ 2.run(AbstractConnection.java:540)           在org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:635)           在org.eclipse.jetty.util.thread.QueuedThreadPool $ 3.run(QueuedThreadPool.java:555)           在java.lang.Thread.run(未知来源)

1 个答案:

答案 0 :(得分:1)

没有这样的限制,前提是您使用的是64位操作系统,并且适当增加了JVM堆大小(例如,通过设置-Xms8G -Xmx64G)。

您一定要考虑升级到更新的Openscoring / JPMML-Evaluator版本(例如从1.1.161.2.12)。如果你有能力的硬件,那么一个Openscoring实例可以轻松容纳数百GB(是的,GB而不是MB)的PMML模型。

至于这个特殊的异常,那么众所周知,一些JAXB库/ JVM组合可能会在解组时破坏数据。您正在目睹某种情况,其中某些SimplePredicate元素属性的值已“丢失”。例如,在Mac OS上运行Java 1.7时会发生这种情况。

您可以通过将Java版本升级到Java 1.8来解决此异常。