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.81k stars 1.99k forks source link

Optional Arguments in R Apply Cause Apply Method to Break. #12750

Open exalate-issue-sync[bot] opened 1 year ago

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

Original [issue|https://stackoverflow.com/questions/52230318/r-function-not-evaluating-properly-on-h2o-dataset] posted by SO user.

The R apply method shows that you can pass optional arguments apply(X, MARGIN, FUN, ...) where … = optional arguments to FUN. but there is a bug that doesn't allow you to pass optional arguments to FUN.

The following code demonstrate the issue

basically this works {code} library(h2o) h2o.init() df <- data.frame( AGE = c(9,7,33,84,86,25)) df_A.hex <- as.h2o( df, 'df_A.hex' ) simple_spline <- function(x) { min(max(x-12,0),12-24) } print(apply(df_A.hex, 1, simple_spline))``` {code}

but this doesn’t work {code} simple_spline <- function( x, L, U ) min( max(x-L,0), U-L) print(apply(df_A.hex, 1, simple_spline)) {code}

it errors out with {code} [1] "Lookup failed to find min" Error in .process.stmnt(stmnt, formalz, envs) : Don't know what to do with statement: min {code}

hasithjp commented 1 year ago

JIRA Issue Migration Info

Jira Issue: PUBDEV-5898 Assignee: New H2O Bugs Reporter: Lauren DiPerna State: Open Fix Version: N/A Attachments: N/A Development PRs: N/A