Repository: systemml Updated Branches: refs/heads/master 202f658c2 -> 7cc70b669
[MINOR] Remove deprecated ppred from JMLC test scripts Project: http://git-wip-us.apache.org/repos/asf/systemml/repo Commit: http://git-wip-us.apache.org/repos/asf/systemml/commit/7cc70b66 Tree: http://git-wip-us.apache.org/repos/asf/systemml/tree/7cc70b66 Diff: http://git-wip-us.apache.org/repos/asf/systemml/diff/7cc70b66 Branch: refs/heads/master Commit: 7cc70b669868d6da292829025232062d08a33537 Parents: 202f658 Author: Deron Eriksson <[email protected]> Authored: Fri Jun 23 13:48:24 2017 -0700 Committer: Deron Eriksson <[email protected]> Committed: Fri Jun 23 13:48:24 2017 -0700 ---------------------------------------------------------------------- .../functions/jmlc/FrameDecodeTest.java | 5 ++--- .../functions/jmlc/FrameIndexingAppendTest.java | 5 ++--- .../functions/jmlc/reuse-glm-predict.dml | 22 ++++++++++---------- .../functions/jmlc/reuse-msvm-predict.dml | 2 +- 4 files changed, 16 insertions(+), 18 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/systemml/blob/7cc70b66/src/test/java/org/apache/sysml/test/integration/functions/jmlc/FrameDecodeTest.java ---------------------------------------------------------------------- diff --git a/src/test/java/org/apache/sysml/test/integration/functions/jmlc/FrameDecodeTest.java b/src/test/java/org/apache/sysml/test/integration/functions/jmlc/FrameDecodeTest.java index 07da75f..59ac69d 100644 --- a/src/test/java/org/apache/sysml/test/integration/functions/jmlc/FrameDecodeTest.java +++ b/src/test/java/org/apache/sysml/test/integration/functions/jmlc/FrameDecodeTest.java @@ -23,9 +23,6 @@ import java.io.IOException; import java.util.ArrayList; import java.util.HashMap; -import org.junit.Assert; -import org.junit.Test; -import org.apache.sysml.api.DMLException; import org.apache.sysml.api.jmlc.Connection; import org.apache.sysml.api.jmlc.PreparedScript; import org.apache.sysml.api.jmlc.ResultVariables; @@ -34,6 +31,8 @@ import org.apache.sysml.runtime.io.IOUtilFunctions; import org.apache.sysml.test.integration.AutomatedTestBase; import org.apache.sysml.test.integration.TestConfiguration; import org.apache.sysml.test.utils.TestUtils; +import org.junit.Assert; +import org.junit.Test; public class FrameDecodeTest extends AutomatedTestBase { http://git-wip-us.apache.org/repos/asf/systemml/blob/7cc70b66/src/test/java/org/apache/sysml/test/integration/functions/jmlc/FrameIndexingAppendTest.java ---------------------------------------------------------------------- diff --git a/src/test/java/org/apache/sysml/test/integration/functions/jmlc/FrameIndexingAppendTest.java b/src/test/java/org/apache/sysml/test/integration/functions/jmlc/FrameIndexingAppendTest.java index 441f447..1e62af9 100644 --- a/src/test/java/org/apache/sysml/test/integration/functions/jmlc/FrameIndexingAppendTest.java +++ b/src/test/java/org/apache/sysml/test/integration/functions/jmlc/FrameIndexingAppendTest.java @@ -23,9 +23,6 @@ import java.io.IOException; import java.util.ArrayList; import java.util.HashMap; -import org.junit.Assert; -import org.junit.Test; -import org.apache.sysml.api.DMLException; import org.apache.sysml.api.jmlc.Connection; import org.apache.sysml.api.jmlc.PreparedScript; import org.apache.sysml.api.jmlc.ResultVariables; @@ -34,6 +31,8 @@ import org.apache.sysml.runtime.io.IOUtilFunctions; import org.apache.sysml.test.integration.AutomatedTestBase; import org.apache.sysml.test.integration.TestConfiguration; import org.apache.sysml.test.utils.TestUtils; +import org.junit.Assert; +import org.junit.Test; public class FrameIndexingAppendTest extends AutomatedTestBase { http://git-wip-us.apache.org/repos/asf/systemml/blob/7cc70b66/src/test/scripts/functions/jmlc/reuse-glm-predict.dml ---------------------------------------------------------------------- diff --git a/src/test/scripts/functions/jmlc/reuse-glm-predict.dml b/src/test/scripts/functions/jmlc/reuse-glm-predict.dml index 5a0dc43..f50d399 100644 --- a/src/test/scripts/functions/jmlc/reuse-glm-predict.dml +++ b/src/test/scripts/functions/jmlc/reuse-glm-predict.dml @@ -111,7 +111,7 @@ if (fileY != " ") # POWER DISTRIBUTIONS (GAUSSIAN, POISSON, GAMMA, ETC.) # if (link_power == 0.0) { - is_zero_Y = ppred (Y, 0.0, "=="); + is_zero_Y = (Y == 0.0); lt_saturated = log (Y + is_zero_Y) - is_zero_Y / (1.0 - is_zero_Y); } else { lt_saturated = Y ^ link_power; @@ -137,7 +137,7 @@ if (fileY != " ") num_categories = ncol (beta) + 1; if (min (Y) <= 0) { # Category labels "0", "-1" etc. are converted into the baseline label - Y = Y + (- Y + num_categories) * ppred (Y, 0, "<="); + Y = Y + (- Y + num_categories) * (Y <= 0); } Y_size = min (num_categories, max(Y)); Y_unsized = table (seq (1, num_records, 1), Y); @@ -149,8 +149,8 @@ if (fileY != " ") } P = means; - zero_Y = ppred (Y, 0.0, "=="); - zero_P = ppred (P, 0.0, "=="); + zero_Y = (Y == 0.0); + zero_P = (P == 0.0); ones_ctg = matrix (1, rows = ncol(Y), cols = 1); logl_vec = rowSums (Y * log (P + zero_Y) ); @@ -163,8 +163,8 @@ if (fileY != " ") means = means * (Y_counts %*% t(ones_ctg)); vars = vars * (Y_counts %*% t(ones_ctg)); - frac_below_5 = sum (ppred (means, 5, "<")) / (nrow (means) * ncol (means)); - frac_below_1 = sum (ppred (means, 1, "<")) / (nrow (means) * ncol (means)); + frac_below_5 = sum (means < 5) / (nrow (means) * ncol (means)); + frac_below_1 = sum (means < 1) / (nrow (means) * ncol (means)); if (frac_below_5 > 0.2 | frac_below_1 > 0.0) { print ("WARNING: residual statistics are inaccurate here due to low cell means."); @@ -312,7 +312,7 @@ glm_means_and_vars = y_prob [, 1] = elt / (1.0 + elt); y_prob [, 2] = 1.0 / (1.0 + elt); } else { if (link_type == 3) { # Binomial.probit - sign_lt = 2 * ppred (linear_terms, 0.0, ">=") - 1; + sign_lt = 2 * (linear_terms >= 0.0) - 1; t_gp = 1.0 / (1.0 + abs (linear_terms) * 0.231641888); # 0.231641888 = 0.3275911 / sqrt (2.0) erf_corr = t_gp * ( 0.254829592 @@ -325,7 +325,7 @@ glm_means_and_vars = y_prob = y_prob / 2; } else { if (link_type == 4) { # Binomial.cloglog elt = exp (linear_terms); - is_too_small = ppred (10000000 + elt, 10000000, "=="); + is_too_small = ((10000000 + elt) == 10000000); y_prob [, 2] = exp (- elt); y_prob [, 1] = (1 - is_too_small) * (1.0 - y_prob [, 2]) + is_too_small * elt * (1.0 - elt / 2); } else { if (link_type == 5) { # Binomial.cauchit @@ -356,15 +356,15 @@ glm_partial_loglikelihood_for_power_dist_and_link = # Assumes: dist_type == 1 num_records = nrow (Y); if (var_power == 1.0) { # Poisson if (link_power == 0.0) { # Poisson.log - is_natural_parameter_log_zero = ppred (linear_terms, -1.0/0.0, "=="); + is_natural_parameter_log_zero = (linear_terms == (-1.0/0.0)); natural_parameters = replace (target = linear_terms, pattern = -1.0/0.0, replacement = 0); b_cumulant = exp (linear_terms); } else { # Poisson.power_nonlog - is_natural_parameter_log_zero = ppred (linear_terms, 0.0, "=="); + is_natural_parameter_log_zero = (linear_terms == 0.0); natural_parameters = log (linear_terms + is_natural_parameter_log_zero) / link_power; b_cumulant = (linear_terms + is_natural_parameter_log_zero) ^ (1.0 / link_power) - is_natural_parameter_log_zero; } - is_minus_infinity = ppred (Y, 0, ">") * is_natural_parameter_log_zero; + is_minus_infinity = (Y > 0) * is_natural_parameter_log_zero; log_l_part = Y * natural_parameters - b_cumulant - is_minus_infinity / (1 - is_minus_infinity); } else { if (var_power == 2.0 & link_power == 0.0) { # Gamma.log http://git-wip-us.apache.org/repos/asf/systemml/blob/7cc70b66/src/test/scripts/functions/jmlc/reuse-msvm-predict.dml ---------------------------------------------------------------------- diff --git a/src/test/scripts/functions/jmlc/reuse-msvm-predict.dml b/src/test/scripts/functions/jmlc/reuse-msvm-predict.dml index 026b88b..56dac69 100644 --- a/src/test/scripts/functions/jmlc/reuse-msvm-predict.dml +++ b/src/test/scripts/functions/jmlc/reuse-msvm-predict.dml @@ -56,7 +56,7 @@ if(cmdLine_Y != " "){ if(min(y) < 1) stop("Stopping due to invalid argument: Label vector (Y) must be recoded") - correct_percentage = sum(ppred(predicted_y - y, 0, "==")) / N * 100; + correct_percentage = sum((predicted_y - y) == 0) / N * 100; acc_str = "Accuracy (%): " + correct_percentage print(acc_str)
