将水模型转换为非水模型 [英] Transforming h2o model into non-h2o one

查看:87
本文介绍了将水模型转换为非水模型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道有可能导出/导入先前经过培训的h2o模型.

I know that there is possibility to export/import h2o model, that was previously trained.

我的问题是-是否可以将h2o模型转换为非h2o模型(仅适用于普通R)?

My question is - is there a way to transform h2o model to a non-h2o one (that just works in plain R)?

我的意思是我不想启动h2o环境(JVM),因为我知道对训练模型的预测只是将矩阵相乘,应用激活函数等.

I mean that I don't want to launch the h2o environment (JVM) since I know that predicting on trained model is simply multiplying matrices, applying activation function etc.

当然可以手动提取权重等,但是我想知道是否有更好的方法可以做到这一点.

Of course it would be possible to extract weights manually etc., but I want to know if there is any better way to do it.

我以前在SA上没有看到有关此问题的任何帖子.

I do not see any previous posts on SA about this problem.

推荐答案

否.

请记住,R只是客户端,它发送API调用:算法(那些矩阵乘法等)全部用Java实现.

Remember that R is just the client, sending API calls: the algorithms (those matrix multiplications, etc.) are all implemented in Java.

他们提供的是POJO,这是您要的,但是使用Java. (POJO代表Plain Old Java Object.)如果在其中一个模型上调用h2o.download_pojo(),您会发现它非常简单.甚至可以编写脚本将其转换为R代码? (尽管可能会更好,但是如果您要解决该问题,请将其转换为C ++代码,然后使用Rcpp!)

What they do offer is a POJO, which is what you are asking for, but in Java. (POJO stands for Plain Old Java Object.) If you call h2o.download_pojo() on one of your models you will see it is quite straightforward. It may even be possible to write a script to convert it to R code? (Though it might be better, if you were going to go to that trouble, to convert it to C++ code, and then use Rcpp!)

您的另一选择是在深度学习的情况下导出权重和偏差,实现您自己的激活函数,然后直接使用它们.

Your other option is to export the weights and biases, in the case of deep learning, implement your own activation function, and use them directly.

但是,就开发人员(易于安装)或计算(对Java代码进行了优化)的角度来看,就我个人而言,我从来没有发现Java方面是瓶颈.

But, personally, I've never found the Java side to be a bottleneck, either from the point of view of dev ops (install is easy) or computation (the Java code is well optimized).

这篇关于将水模型转换为非水模型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆