h2oai / h2o-3

H2O is an Open Source, Distributed, Fast & Scalable Machine Learning Platform: Deep Learning, Gradient Boosting (GBM) & XGBoost, Random Forest, Generalized Linear Modeling (GLM with Elastic Net), K-Means, PCA, Generalized Additive Models (GAM), RuleFit, Support Vector Machine (SVM), Stacked Ensembles, Automatic Machine Learning (AutoML), etc.
http://h2o.ai
Apache License 2.0
6.93k stars 2k forks source link

Running GAM twice in a row gives Null Pointer Exception #7387

Closed exalate-issue-sync[bot] closed 1 year ago

exalate-issue-sync[bot] commented 1 year ago

This should just overwrite the previous model & R object, rather than give an NPE.

{code:java}library(h2o)

> Warning: package 'h2o' was built under R version 4.0.5

>

> ----------------------------------------------------------------------

>

> Your next step is to start H2O:

> > h2o.init()

>

> For H2O package documentation, ask for help:

> > ??h2o

>

> After starting H2O, you can use the Web UI at http://localhost:54321

> For more information visit https://docs.h2o.ai

>

> ----------------------------------------------------------------------

>

> Attaching package: 'h2o'

> The following objects are masked from 'package:stats':

>

> cor, sd, var

> The following objects are masked from 'package:base':

>

> %*%, %in%, &&, ||, apply, as.factor, as.numeric, colnames,

> colnames<-, ifelse, is.character, is.factor, is.numeric, log,

> log10, log1p, log2, round, signif, trunc

h2o.init()

> Connection successful!

>

> R is connected to the H2O cluster:

> H2O cluster uptime: 19 minutes 25 seconds

> H2O cluster timezone: America/Chicago

> H2O data parsing timezone: UTC

> H2O cluster version: 3.32.1.3

> H2O cluster version age: 2 months and 21 days

> H2O cluster name: H2O_started_from_R_E014307_zqv421

> H2O cluster total nodes: 1

> H2O cluster total memory: 26.08 GB

> H2O cluster total cores: 20

> H2O cluster allowed cores: 20

> H2O cluster healthy: TRUE

> H2O Connection ip: localhost

> H2O Connection port: 54321

> H2O Connection proxy: NA

> H2O Internal Security: FALSE

> H2O API Extensions: Amazon S3, Algos, AutoML, Core V3, TargetEncoder, Core V4

> R Version: R version 4.0.2 (2020-06-22)

create frame knots

knots1 <- c(-1.99905699, -0.98143075, 0.02599159, 1.00770987, 1.99942290) frame_Knots1 <- as.h2o(knots1)

> | | | 0% | |======================================================================| 100%

import the dataset

h2o_data <- h2o.importFile("https://s3.amazonaws.com/h2o-public-test-data/smalldata/glm_test/multinomial_10_classes_10_cols_10000_Rows_train.csv")

> | | | 0% | |==================== | 29% | |================================================================== | 94% | |======================================================================| 100%

h2o_data[["C1"]] <- as.factor(h2o_data[["C1"]])

build the GAM model

gam_model <- h2o.gam(x = "C6", y = "C1", training_frame = h2o_data, family = 'multinomial', gam_columns = "C6", scale = 1, num_knots = 5, knot_ids = h2o.keyof(frame_Knots1))

> | | | 0% | |======================================================================| 100%

error

gam_model <- h2o.gam(x = "C6", y = "C1", training_frame = h2o_data, family = 'multinomial', gam_columns = "C6", scale = 1, num_knots = 5, knot_ids = h2o.keyof(frame_Knots1))

> | | | 0%

>

> java.lang.NullPointerException

>

> java.lang.NullPointerException

> at water.Scope.track(Scope.java:94)

> at hex.gam.GAM.generateKnotsFromKeys(GAM.java:153)

> at hex.gam.GAM.validateGamParameters(GAM.java:268)

> at hex.gam.GAM.init(GAM.java:216)

> at hex.gam.GAM$GAMDriver.computeImpl(GAM.java:664)

> at hex.ModelBuilder$Driver.compute2(ModelBuilder.java:246)

> at water.H2O$H2OCountedCompleter.compute(H2O.java:1637)

> 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{code}

exalate-issue-sync[bot] commented 1 year ago

Wendy commented: Thank you Erin. Should be a simple fix.

h2o-ops commented 1 year ago

JIRA Issue Details

Jira Issue: PUBDEV-8267 Assignee: Wendy Reporter: Erin LeDell State: Resolved Fix Version: 3.34.0.1 Attachments: N/A Development PRs: Available

h2o-ops commented 1 year ago

Linked PRs from JIRA

https://github.com/h2oai/h2o-3/pull/5636