Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 3.10.5.1
    • Fix Version/s: 3.18.0.1
    • Component/s: Python, R, XGBoost
    • Labels:
      None
    • CustomerVisible:
      No
    • Sprint:

      Description

      Binary save/load of XGBoost not working. R example below (but this is probably also broken in Python and should be checked & validated).

      library(h2o)
      h2o.init()
      
      # Import a sample binary outcome train/test set into H2O
      train <- h2o.importFile("https://s3.amazonaws.com/erin-data/higgs/higgs_train_10k.csv")
      
      # Identify predictors and response
      y <- "response"
      x <- setdiff(names(train), y)
      
      # For binary classification, response should be a factor
      train[,y] <- as.factor(train[,y])
      
      
      # Train XGB-GBM
      xgb <- h2o.xgboost(x = x,
                         y = y,
                         training_frame = train,
                         distribution = "bernoulli",
                         seed = 1)
      
      # This shoudl also not be broken.  Will file a separate bug.
      #auc <- h2o.auc(h2o.performance(xgb, newdata = test))
      #> h2o.performance(xgb, newdata = test)
      #Error in Filter(function(mm) { : subscript out of bounds
      
      mfile <- h2o.saveModel(xgb, path = "/Users/me/Downloads")
      rm("xgb", "train", "test")
      
      
      h2o.shutdown(prompt = FALSE)
      h2o.init()
      
      # Load xgb
      xgb <- h2o.loadModel(path = mfile)
      xgb
      
      test <- h2o.importFile("https://s3.amazonaws.com/erin-data/higgs/higgs_test_5k.csv")
      y <- "response"
      test[,y] <- as.factor(test[,y])
      
      
      # Gives error
      h2o.performance(xgb, newdata = test)
      # ERROR: Unexpected HTTP Status code: 500 Server Error (url = http://localhost:54321/3/ModelMetrics/models/XGBoost_model_R_1497468710799_1/frames/RTMP_sid_a904_10)
      # 
      # java.lang.NullPointerException
      # [1] "java.lang.NullPointerException"                                                                              
      # [2] "    hex.tree.xgboost.XGBoost.convertFrametoDMatrix(XGBoost.java:260)"                                        
      # [3] "    hex.tree.xgboost.XGBoostModel.score(XGBoostModel.java:439)"                                              
      # [4] "    hex.Model.score(Model.java:1062)"                                                                        
      # [5] "    water.api.ModelMetricsHandler.score(ModelMetricsHandler.java:235)"                                       
      # [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:448)"                                                   
      # [12] "    water.api.RequestServer.doGeneric(RequestServer.java:297)"                                               
      # [13] "    water.api.RequestServer.doPost(RequestServer.java:223)"                                                  
      # [14] "    javax.servlet.http.HttpServlet.service(HttpServlet.java:755)"                                            
      # [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:503)"                              
      # [18] "    org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1086)"                      
      # [19] "    org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:429)"                               
      # [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.JettyHTTPD$LoginHandler.handle(JettyHTTPD.java:183)"                                               
      # [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.content(AbstractHttpConnection.java:982)"                
      # [31] "    org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.content(AbstractHttpConnection.java:1043)"
      # [32] "    org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:865)"                                        
      # [33] "    org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:240)"                                   
      # [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$3.run(QueuedThreadPool.java:543)"                         
      # [38] "    java.lang.Thread.run(Thread.java:745)"                                                                   
      # 
      # Error in .h2o.doSafeREST(h2oRestApiVersion = h2oRestApiVersion, urlSuffix = page,  : 
      #                            
      #                            
      #                            ERROR MESSAGE:
      #                            
      #                            Caught exception: java.lang.NullPointerExceptio
      
      # Gives error
      pred <- h2o.predict(xgb, newdata = test)
      # java.lang.NullPointerException
      #
      # java.lang.NullPointerException
      # at hex.tree.xgboost.XGBoost.convertFrametoDMatrix(XGBoost.java:260)
      # at hex.tree.xgboost.XGBoostModel.score(XGBoostModel.java:439)
      # at water.api.ModelMetricsHandler$1.compute2(ModelMetricsHandler.java:351)
      # at water.H2O$H2OCountedCompleter.compute(H2O.java:1349)
      # at jsr166y.CountedCompleter.exec(CountedCompleter.java:468)
      # at jsr166y.ForkJoinTask.doExec(ForkJoinTask.java:263)
      # at jsr166y.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:974)
      # at jsr166y.ForkJoinPool.runWorker(ForkJoinPool.java:1477)
      # at jsr166y.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:104)
      # 
      # Error: java.lang.NullPointerException
      

        Attachments

          Activity

            People

            • Assignee:
              rpeck Raymond Peck (Inactive)
              Reporter:
              erin Erin LeDell
            • Votes:
              2 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: