R H2O 目标编码模型 - 保存和加载

R H2O target encoding model - Saving and Loading

我正在使用 H2O 目标编码来处理我的一些因子变量。但是,我想我遇到了一个问题。

我可以轻松使用该函数,因此创建并应用了目标编码 "model"。但是,我需要能够保存所述模型并在以后使用它(例如使用实际的 H2O 模型)。

我已经用R的save函数保存了model对象,现在加载后不能用了(搞定

ERROR: Unexpected HTTP Status code: 404 Not Found (url = http://localhost:54014/3/Frames/RTMP_sid_93aa_3?row_count=10)

water.exceptions.H2OKeyNotFoundArgumentException
 [1] "water.exceptions.H2OKeyNotFoundArgumentException: Object 'RTMP_sid_93aa_3' not found for argument: key"             
 [2] "    water.api.FramesHandler.getFromDKV(FramesHandler.java:135)"                                                     
 [3] "    water.api.FramesHandler.doFetch(FramesHandler.java:225)"                                                        
 [4] "    water.api.FramesHandler.doFetch(FramesHandler.java:220)"                                                        
 [5] "    water.api.FramesHandler.fetch(FramesHandler.java:199)"                                                          
 [6] "    sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)"                                                    
 [7] "    sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)"                                  
 [8] "    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)"                          
 [9] "    java.lang.reflect.Method.invoke(Method.java:497)"                                                               
[10] "    water.api.Handler.handle(Handler.java:63)"                                                                      
[11] "    water.api.RequestServer.serve(RequestServer.java:482)"                                                          
[12] "    water.api.RequestServer.doGeneric(RequestServer.java:327)"                                                      
[13] "    water.api.RequestServer.doGet(RequestServer.java:251)"                                                          
[14] "    javax.servlet.http.HttpServlet.service(HttpServlet.java:735)"                                                   
[15] "    javax.servlet.http.HttpServlet.service(HttpServlet.java:848)"                                                   
[16] "    org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:684)"                                         
[17] "    org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:501)"                                     
[18] "    org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1086)"                             
[19] "    org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:427)"                                      
[20] "    org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1020)"                              
[21] "    org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:135)"                                  
[22] "    org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:154)"                          
[23] "    org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:116)"                                
[24] "    water.webserver.jetty8.Jetty8ServerAdapter$LoginHandler.handle(Jetty8ServerAdapter.java:119)"                   
[25] "    org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:154)"                          
[26] "    org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:116)"                                
[27] "    org.eclipse.jetty.server.Server.handle(Server.java:370)"                                                        
[28] "    org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:494)"                 
[29] "    org.eclipse.jetty.server.BlockingHttpConnection.handleRequest(BlockingHttpConnection.java:53)"                  
[30] "    org.eclipse.jetty.server.AbstractHttpConnection.headerComplete(AbstractHttpConnection.java:973)"                
[31] "    org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.headerComplete(AbstractHttpConnection.java:1035)"
[32] "    org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:641)"                                               
[33] "    org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:231)"                                          
[34] "    org.eclipse.jetty.server.BlockingHttpConnection.handle(BlockingHttpConnection.java:72)"                         
[35] "    org.eclipse.jetty.server.bio.SocketConnector$ConnectorEndPoint.run(SocketConnector.java:264)"                   
[36] "    org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:608)"                               
[37] "    org.eclipse.jetty.util.thread.QueuedThreadPool.run(QueuedThreadPool.java:543)"                                
[38] "    java.lang.Thread.run(Thread.java:745)"                                                                          

Error in .h2o.doSafeREST(h2oRestApiVersion = h2oRestApiVersion, urlSuffix = page,  : 


ERROR MESSAGE:

Object 'RTMP_sid_93aa_3' not found for argument: key

两个问题:

1 - 有没有办法继续使用我以这种方式保存的编码?

2 - 我应该如何保存和加载它?

很遗憾,尚不支持在模型中保存编码图。但这是我们现在正在努力的事情。回答您的问题:

  1. 否,目前模型对象没有关于编码映射的信息。模型将数据作为输入,不知道是否应用了目标编码。
  2. 至于现在,您无法将编码与模型一起保存。