forked from h2oai/h2o-2
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of https://github.com/0xdata/h2o
- Loading branch information
Showing
12 changed files
with
196 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
|
||
setwd(normalizePath(dirname(R.utils::commandArgs(asValues=TRUE)$"f"))) | ||
source('../../findNSourceUtils.R') | ||
|
||
# library(h2o) | ||
# library(testthat) | ||
# h2o.setLogPath(getwd(), "Command") | ||
# h2o.setLogPath(getwd(), "Error") | ||
# h2o.startLogging() | ||
# conn = h2o.init() | ||
|
||
|
||
test.pub.668 <- function(conn) { | ||
|
||
a_initial = as.data.frame(cbind( | ||
c(0,0,1,0,0,1,0,0,0,0), | ||
c(1,1,1,0,1,0,1,0,1,0), | ||
c(1,0,1,0,1,0,1,0,0,1), | ||
c(1,1,0,0,0,1,0,0,0,1), | ||
c(1,1,1,0,1,0,0,0,1,1), | ||
c(1,0,1,0,0,0,0,0,1,1), | ||
c(1,1,1,0,0,0,1,1,1,0), | ||
c(0,0,1,1,1,0,0,1,1,0), | ||
c(0,1,1,1,1,0,0,1,1,0), | ||
c(0,0,0,0,0,1,1,0,0,0) | ||
)) | ||
|
||
|
||
a = a_initial | ||
a.h2o <- as.h2o(conn, a_initial, key="r.hex") | ||
d0 = apply(a.h2o, 2, sum) | ||
d = ifelse(F, a.h2o[1,] , d0) | ||
dd = ifelse(F, a[1,] , apply(a, 2, sum)) | ||
a.h2o.R = as.matrix(a.h2o) | ||
a | ||
a.h2o.R | ||
expect_that(all(a == a.h2o.R), equals(T)) | ||
expect_that(all(d == dd), equals(T)) | ||
|
||
|
||
a = a_initial | ||
a.h2o <- as.h2o(conn, a_initial, key="r.hex") | ||
d0 = apply(a.h2o, 2, sum) | ||
d = ifelse(F, a.h2o[1,] , apply(a.h2o, 2, sum)) | ||
dd = ifelse(F, a[1,] , apply(a, 2, sum)) | ||
a.h2o.R = as.matrix(a.h2o) | ||
a | ||
a.h2o.R | ||
expect_that(all(a == a.h2o.R), equals(T)) | ||
expect_that(all(d == dd), equals(T)) | ||
|
||
|
||
a = a_initial | ||
a.h2o <- as.h2o(conn, a_initial, key="r.hex") | ||
d = ifelse(F, a.h2o[1,] , 0) | ||
dd = ifelse(F, a[1,] , 0) | ||
a.h2o.R = as.matrix(a.h2o) | ||
a | ||
a.h2o.R | ||
expect_that(all(a == a.h2o.R), equals(T)) | ||
expect_that(all(d == dd), equals(T)) | ||
|
||
|
||
a = a_initial | ||
a.h2o <- as.h2o(conn, a_initial, key="r.hex") | ||
d = ifelse(FALSE, a.h2o[1,] , apply(a.h2o,2,sum)); g = ifelse(FALSE, 1.23<2.34 , min(1,2)) | ||
dd = ifelse(FALSE, a[1,] , apply(a,2,sum)); gg = ifelse(FALSE, 1.23<2.34, min(1,2)) | ||
a.h2o.R = as.matrix(a.h2o) | ||
a | ||
a.h2o.R | ||
expect_that(all(a == a.h2o.R), equals(T)) | ||
expect_that(all(d == dd), equals(T)) | ||
|
||
|
||
testEnd() | ||
} | ||
|
||
doTest("Test for pub-668.", test.pub.668) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,45 @@ | ||
library(h2o) | ||
library(testthat) | ||
conn = h2o.init() | ||
|
||
a_initial = cbind(c(0,0,0,0), c(1,1,1,1)) | ||
a = a_initial | ||
|
||
a.h2o <- as.h2o(conn, a_initial, key="A.hex") | ||
a.h2o[,1] = c(0) | ||
a[,1] = c(0) | ||
a.h2o.R = as.matrix(a.h2o) | ||
expect_that(all(a == a.h2o.R), equals(T)) | ||
|
||
a.h2o <- as.h2o(conn, a_initial, key="A.hex") | ||
a.h2o[,1] = c(1) | ||
a[,1] = c(1) | ||
a.h2o.R = as.matrix(a.h2o) | ||
expect_that(all(a == a.h2o.R), equals(T)) | ||
|
||
a.h2o <- as.h2o(conn, a_initial, key="A.hex") | ||
a.h2o[,1] = 0 | ||
a[,1] = 0 | ||
a.h2o.R = as.matrix(a.h2o) | ||
expect_that(all(a == a.h2o.R), equals(T)) | ||
|
||
a.h2o <- as.h2o(conn, a_initial, key="A.hex") | ||
a.h2o[,1] = 1 | ||
a[,1] = 1 | ||
a.h2o.R = as.matrix(a.h2o) | ||
expect_that(all(a == a.h2o.R), equals(T)) | ||
|
||
# a.h2o[,1] = c(0,0) | ||
# Error in `[<-`(`*tmp*`, , 1, value = c(0, 0)) : | ||
# value must be either a single number or a vector of length 4 | ||
|
||
|
||
|
||
# library(h2o) | ||
# library(testthat) | ||
# conn = h2o.init() | ||
|
||
setwd(normalizePath(dirname(R.utils::commandArgs(asValues=TRUE)$"f"))) | ||
source('../../findNSourceUtils.R') | ||
|
||
test.pub.657 <- function(conn) { | ||
|
||
a_initial = cbind(c(0,0,0,0), c(1,1,1,1)) | ||
a = a_initial | ||
|
||
a.h2o <- as.h2o(conn, a_initial, key="A.hex") | ||
a.h2o[,1] = c(0) | ||
a[,1] = c(0) | ||
a.h2o.R = as.matrix(a.h2o) | ||
expect_that(all(a == a.h2o.R), equals(T)) | ||
|
||
a.h2o <- as.h2o(conn, a_initial, key="A.hex") | ||
a.h2o[,1] = c(1) | ||
a[,1] = c(1) | ||
a.h2o.R = as.matrix(a.h2o) | ||
expect_that(all(a == a.h2o.R), equals(T)) | ||
|
||
a.h2o <- as.h2o(conn, a_initial, key="A.hex") | ||
a.h2o[,1] = 0 | ||
a[,1] = 0 | ||
a.h2o.R = as.matrix(a.h2o) | ||
expect_that(all(a == a.h2o.R), equals(T)) | ||
|
||
a.h2o <- as.h2o(conn, a_initial, key="A.hex") | ||
a.h2o[,1] = 1 | ||
a[,1] = 1 | ||
a.h2o.R = as.matrix(a.h2o) | ||
expect_that(all(a == a.h2o.R), equals(T)) | ||
|
||
# a.h2o[,1] = c(0,0) | ||
# Error in `[<-`(`*tmp*`, , 1, value = c(0, 0)) : | ||
# value must be either a single number or a vector of length 4 | ||
|
||
testEnd() | ||
} | ||
|
||
doTest("Test for pub-657.", test.pub.657) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters