Skip to content

Instantly share code, notes, and snippets.

@krishnakalyan3
Created May 8, 2017 02:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save krishnakalyan3/be28d984714a1be97f66dee15b9154ae to your computer and use it in GitHub Desktop.
Save krishnakalyan3/be28d984714a1be97f66dee15b9154ae to your computer and use it in GitHub Desktop.
glm difference
krishna@Krishna:~/open-source/incubator-systemml$ diff scripts/algorithms/GLM.dml src/test/scripts/applications/glm/GLM.dml
201c201
< is_unsafe = (var_X_cols <= 0);
---
> is_unsafe = ppred (var_X_cols, 0.0, "<=");
236c236
< is_Y_negative = (Y == bernoulli_No_label);
---
> is_Y_negative = ppred (Y, bernoulli_No_label, "==");
480c480
< if (dispersion <= 0) {
---
> if (dispersion <= 0.0) {
522,526c522,526
< if (var_power == 0 & link_power == -1.0) {print ("Gaussian.inverse"); } else {
< if (var_power == 0 & link_power == 0) {print ("Gaussian.log"); } else {
< if (var_power == 0 & link_power == 0.5) {print ("Gaussian.sqrt"); } else {
< if (var_power == 0 & link_power == 1.0) {print ("Gaussian.id"); } else {
< if (var_power == 0 ) {print ("Gaussian.power_nonlog"); } else {
---
> if (var_power == 0.0 & link_power == -1.0) {print ("Gaussian.inverse"); } else {
> if (var_power == 0.0 & link_power == 0.0) {print ("Gaussian.log"); } else {
> if (var_power == 0.0 & link_power == 0.5) {print ("Gaussian.sqrt"); } else {
> if (var_power == 0.0 & link_power == 1.0) {print ("Gaussian.id"); } else {
> if (var_power == 0.0 ) {print ("Gaussian.power_nonlog"); } else {
528c528
< if (var_power == 1.0 & link_power == 0) {print ("Poisson.log"); } else {
---
> if (var_power == 1.0 & link_power == 0.0) {print ("Poisson.log"); } else {
533c533
< if (var_power == 2.0 & link_power == 0) {print ("Gamma.log"); } else {
---
> if (var_power == 2.0 & link_power == 0.0) {print ("Gamma.log"); } else {
539c539
< if (var_power == 3.0 & link_power == 0) {print ("InvGaussian.log"); } else {
---
> if (var_power == 3.0 & link_power == 0.0) {print ("InvGaussian.log"); } else {
543c543
< if ( link_power == 0) {print ("PowerDist.log"); } else {
---
> if ( link_power == 0.0) {print ("PowerDist.log"); } else {
554c554
< if (link_type == 1 & link_power == 0) {print ("Binomial.log"); } else {
---
> if (link_type == 1 & link_power == 0.0) {print ("Binomial.log"); } else {
577c577
< is_n_zero = (n_corr == 0);
---
> is_n_zero = ppred (n_corr, 0.0, "==");
582,584c582,584
< if (link_power == 0) {
< if (sum (y_corr < 0) == 0) {
< is_zero_y_corr = (y_corr == 0);
---
> if (link_power == 0.0) {
> if (sum (ppred (y_corr, 0.0, "<")) == 0) {
> is_zero_y_corr = ppred (y_corr, 0.0, "==");
592c592
< if (sum (y_corr < 0) == 0) {
---
> if (sum (ppred (y_corr, 0.0, "<")) == 0) {
595,597c595,597
< } else { if (link_power > 0) {
< if (sum (y_corr < 0) == 0) {
< is_zero_y_corr = (y_corr == 0);
---
> } else { if (link_power > 0.0) {
> if (sum (ppred (y_corr, 0.0, "<")) == 0) {
> is_zero_y_corr = ppred (y_corr, 0.0, "==");
601c601
< if (sum (y_corr <= 0) == 0) {
---
> if (sum (ppred (y_corr, 0.0, "<=")) == 0) {
608,610c608,610
< if (link_type == 1 & link_power == 0) { # Binomial.log
< if (sum (y_corr < 0) == 0) {
< is_zero_y_corr = (y_corr == 0);
---
> if (link_type == 1 & link_power == 0.0) { # Binomial.log
> if (sum (ppred (y_corr, 0.0, "<")) == 0) {
> is_zero_y_corr = ppred (y_corr, 0.0, "==");
613,615c613,615
< } else { if (link_type == 1 & link_power > 0) { # Binomial.power_nonlog pos
< if (sum (y_corr < 0) == 0) {
< is_zero_y_corr = (y_corr == 0);
---
> } else { if (link_type == 1 & link_power > 0.0) { # Binomial.power_nonlog pos
> if (sum (ppred (y_corr, 0.0, "<")) == 0) {
> is_zero_y_corr = ppred (y_corr, 0.0, "==");
619c619
< if (sum (y_corr <= 0) == 0) {
---
> if (sum (ppred (y_corr, 0.0, "<=")) == 0) {
623,624c623,624
< is_zero_y_corr = (y_corr <= 0);
< is_one_y_corr = (y_corr >= 1.0);
---
> is_zero_y_corr = ppred (y_corr, 0.0, "<=");
> is_one_y_corr = ppred (y_corr, 1.0, ">=");
630c630
< y_below_half = y_corr + (1.0 - 2.0 * y_corr) * (y_corr > 0.5);
---
> y_below_half = y_corr + (1.0 - 2.0 * y_corr) * ppred (y_corr, 0.5, ">");
633c633
< linear_terms = approx_inv_Gauss_CDF * (1.0 - 2.0 * (y_corr > 0.5))
---
> linear_terms = approx_inv_Gauss_CDF * (1.0 - 2.0 * ppred (y_corr, 0.5, ">"))
650c650
< if ((dist_type == 1 & link_type == 1 & link_power == 0) |
---
> if ((dist_type == 1 & link_type == 1 & link_power == 0.0) |
654c654
< } else { if (link_type == 1 & link_power == 0) {
---
> } else { if (link_type == 1 & link_power == 0.0) {
664c664
< if (desired_eta != 0) {
---
> if (desired_eta != 0.0) {
715c715
< if (link_power == 0) {
---
> if (link_power == 0.0) {
734c734
< if (link_power == 0) { # Binomial.log
---
> if (link_power == 0.0) { # Binomial.log
742c742
< } else { if (sum (linear_terms < 0) == 0) {
---
> } else { if (sum (ppred (linear_terms, 0.0, "<")) == 0) {
747c747
< is_y_0 = (Y [, 1] == 0);
---
> is_y_0 = ppred (Y [, 1], 0.0, "==");
753,754c753,754
< is_LT_pos_infinite = (linear_terms == 1.0/0.0);
< is_LT_neg_infinite = (linear_terms == -1.0/0.0);
---
> is_LT_pos_infinite = ppred (linear_terms, 1.0/0.0, "==");
> is_LT_neg_infinite = ppred (linear_terms, -1.0/0.0, "==");
765c765
< is_lt_pos = (linear_terms >= 0);
---
> is_lt_pos = ppred (linear_terms, 0.0, ">=");
780c780
< is_too_small = ((10000000 + the_exp) == 10000000);
---
> is_too_small = ppred (10000000 + the_exp, 10000000, "==");
812c812
< if (var_power == 1.0 & link_power == 0) { # Poisson.log
---
> if (var_power == 1.0 & link_power == 0.0) { # Poisson.log
814c814
< is_natural_parameter_log_zero = (linear_terms == -1.0/0.0);
---
> is_natural_parameter_log_zero = ppred (linear_terms, -1.0/0.0, "==");
817c817
< if (sum (linear_terms < 0) == 0) {
---
> if (sum (ppred (linear_terms, 0.0, "<")) == 0) {
819c819
< is_natural_parameter_log_zero = (linear_terms == 0);
---
> is_natural_parameter_log_zero = ppred (linear_terms, 0.0, "==");
823c823
< if (sum (linear_terms < 0) == 0) {
---
> if (sum (ppred (linear_terms, 0.0, "<")) == 0) {
825c825
< is_natural_parameter_log_zero = (linear_terms == 0);
---
> is_natural_parameter_log_zero = ppred (linear_terms, 0.0, "==");
828,830c828,830
< } else { if (var_power == 1.0 & link_power > 0) { # Poisson.power_nonlog, pos
< if (sum (linear_terms < 0) == 0) {
< is_natural_parameter_log_zero = (linear_terms == 0);
---
> } else { if (var_power == 1.0 & link_power > 0.0) { # Poisson.power_nonlog, pos
> if (sum (ppred (linear_terms, 0.0, "<")) == 0) {
> is_natural_parameter_log_zero = ppred (linear_terms, 0.0, "==");
835c835
< if (sum (linear_terms <= 0) == 0) {
---
> if (sum (ppred (linear_terms, 0.0, "<=")) == 0) {
840c840
< if (sum (linear_terms <= 0) == 0) {
---
> if (sum (ppred (linear_terms, 0.0, "<=")) == 0) {
845c845
< if (sum (linear_terms <= 0) == 0) {
---
> if (sum (ppred (linear_terms, 0.0, "<=")) == 0) {
849c849
< } else { if (var_power == 2.0 & link_power == 0) { # Gamma.log
---
> } else { if (var_power == 2.0 & link_power == 0.0) { # Gamma.log
853c853
< if (sum (linear_terms <= 0) == 0) {
---
> if (sum (ppred (linear_terms, 0.0, "<=")) == 0) {
857c857
< } else { if (link_power == 0) { # PowerDist.log
---
> } else { if (link_power == 0.0) { # PowerDist.log
870c870
< if (sum (linear_terms <= 0) == 0) {
---
> if (sum (ppred (linear_terms, 0.0, "<=")) == 0) {
884c884
< if (sum (linear_terms <= 0) == 0) {
---
> if (sum (ppred (linear_terms, 0.0, "<=")) == 0) {
890c890
< if (sum (is_natural_parameter_log_zero * abs (Y)) > 0) {
---
> if (sum (is_natural_parameter_log_zero * abs (Y)) > 0.0) {
908,909c908,909
< does_prob_contradict = (Y_prob <= 0);
< if (sum (does_prob_contradict * abs (Y)) == 0) {
---
> does_prob_contradict = ppred (Y_prob, 0.0, "<=");
> if (sum (does_prob_contradict * abs (Y)) == 0.0) {
952c952
< if (link_power == 0) { # Binomial.log
---
> if (link_power == 0.0) { # Binomial.log
957c957
< if (sum (linear_terms < 0) == 0) {
---
> if (sum (ppred (linear_terms, 0.0, "<")) == 0) {
962,963c962,963
< is_LT_pos_infinite = (linear_terms == 1.0/0.0);
< is_LT_neg_infinite = (linear_terms == -1.0/0.0);
---
> is_LT_pos_infinite = ppred (linear_terms, 1.0/0.0, "==");
> is_LT_neg_infinite = ppred (linear_terms, -1.0/0.0, "==");
971c971
< lt_pos_neg = (finite_linear_terms >= 0) %*% p_one_m_one + ones_r %*% zero_one;
---
> lt_pos_neg = ppred (finite_linear_terms, 0.0, ">=") %*% p_one_m_one + ones_r %*% zero_one;
983c983
< is_too_small = ((10000000 + the_exp) == 10000000);
---
> is_too_small = ppred (10000000 + the_exp, 10000000, "==");
1151c1151
< if (x_to_truncate < 0) {
---
> if (x_to_truncate < 0.0) {
1157c1157
< while (res_eee != 0) {
---
> while (res_eee != 0.0) {
1165c1165
< if (d_eee < 0) {
---
> if (d_eee < 0.0) {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment