java调用神经网络模型,将PMML - 模型(人工神经网络)转换为Java代码

I have a PMML file of a trained Artificial Neural Network (ANN). I would like to create a Java method which simply takes in the inputs and returns the targeted value.

This seems pretty easy, but I do not know how realize it.

The PMML Version = 3.0

Update: 24.05.2013

I tried to use the jpmml Java API.

This is how I have done:

(1) Downloaded via Maven Central Repository (link) three .Jar files:

pmml-manager-1.0.2.jar

pmml-model-1.0.2.jar

pmml-evaluator-1.0.2.jar

(2) Used eclipse to "configure Build path" and added those three external .Jar's

(3) Import my PMML-File named "text.xml" ( an artificial neural network (ANN)) PMML version="3.0"

(4) Tried to run an example "TreeModelTraversalExample.java" provided by the jpmml-project

Obviously it did not work for some reasons:

the mentioned example is not for ANN's. How to rewrite it?

my PMML-file is in XML-format. Is it the right format?

I do not know how to handle or to add Java API's. Should I even add those by "configure build path" in eclipse?

Obvious fact #2, I have no clue what I do :-)

Thanks again and kindest regards.

Stefan

解决方案

JPMML should be able to handle PMML 3.X and newer versions of NeuralNetwork models without problem. Moreover, it should be able to handle all the normalization and denormalization transformations that may accompany such models.

I could use a clarification that why are you interested in converting PMML models to Java code in the first place. This complicates the whole matter a lot and it doesn't add any value. The JPMML library itself is rather compact and has minimal external dependencies (at the moment of writing this, it only depends on commons-math). There shouldn't be much difference performance-wise. You can reasonably expect to obtain up to 10'000 scorings/sec on a modern desktop computer.

The JPMML codebase has recently moved to GitHub: http://github.com/jpmml/jpmml

Fellow coders in Turn Inc. have forked this codebase and are implementing PMML-to-Java translation (see top-level module "pmml-translation") for selected model types: https://github.com/turn/jpmml

At the moment I recommend you to check out the Openscoring project (uses JPMML internally): http://www.openscoring.org

Then, you could try the following:

Deploy your XML file using the HTTP PUT method.

Get your model summary information using the HTTP GET method. If the request succeeds (as opposed to failing with an HTTP status 500 error code) then your model is well supported.

Execute the model either in single prediction mode or batch prediction mode using the HTTP POST method. Try sending larger batches to see if it meets your performance requirements.

Undeploy the model using the HTTP DELETE method.

You can always try contacting project owners for more insight. I'm sure they are nice people.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
### 回答1: 要下载pmml-lightgbm-example-executable-1.4-snapshot.jar,您可以按照以下步骤进行操作: 第一步,打开任意一个浏览器,例如Google Chrome,Mozilla Firefox或者Microsoft Edge。 第二步,使用浏览器搜索引擎,输入“pmml-lightgbm-example-executable-1.4-snapshot.jar 下载”进行搜索。 第三步,浏览搜索结果,并找到可信赖的下载源。可以尝试查找官方网站或相关开发者社区。 第四步,进入下载源的网站,找到相关的下载链接或按钮。 第五步,点击下载链接或按钮,开始下载pmml-lightgbm-example-executable-1.4-snapshot.jar。 第六步,等待下载完成。下载速度取决于您的互联网连接速度以及文件的大小。 第七步,下载完成后,在您的计算机上找到并保存该文件。可以选择在默认下载文件夹中保存,或者选择自定义的文件夹。 通过以上步骤,您可以成功下载pmml-lightgbm-example-executable-1.4-snapshot.jar。请注意确保您从可信赖的源获取文件,以防止下载到恶意软件或病毒。 ### 回答2: 要下载pmml-lightgbm-example-executable-1.4-snapshot.jar,你可以按照以下步骤进行操作: 1. 打开你的浏览器,并搜索"pmml-lightgbm-example-executable-1.4-snapshot.jar"。 2. 在搜索结果中找到可靠的下载来源,如GitHub、SourceForge等。 3. 点击下载链接,通常会有一个下载按钮或链接,点击它。 4. 你的浏览器会开始下载这个文件。你可以选择保存文件的位置或使用默认下载位置。 5. 下载完成后,在你选择的下载位置找到.jar文件。你可以使用文件管理器来导航到该位置。 6. 双击这个.jar文件,它将在你的计算机上自动运行/安装。 7. 如果有任何提示或说明,请按照该文件的指示进行。 这样,你就成功下载了pmml-lightgbm-example-executable-1.4-snapshot.jar文件。请注意,根据你下载文件的来源,步骤可能会有所不同。务必使用可靠且合法的来源来下载文件,以确保文件的安全性和完整性。 ### 回答3: 要下载pmml-lightgbm-example-executable-1.4-snapshot.jar,可以按以下步骤进行操作: 1. 打开网页浏览器,前往pmml-lightgbm-example在GitHub的页面。 2. 在页面上找到并点击“Download”按钮,通常位于页面的右上方。 3. 选择合适的下载选项,例如选择下载最新版本的jar文件。 4. 保存jar文件到你想要存放的目录中,可以选择默认的下载目录或者选择特定的文件夹。 5. 下载完成后,找到保存的jar文件。 现在,你已经成功地下载了pmml-lightgbm-example-executable-1.4-snapshot.jar文件,并可以在你的计算机中使用它了。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值