Skip to content

Commit 0b6dc73

Browse files
bugfix
1 parent ea0c39d commit 0b6dc73

File tree

3 files changed

+37
-37
lines changed

3 files changed

+37
-37
lines changed

cpp/APLRRegressor.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2005,8 +2005,8 @@ void APLRRegressor::find_final_min_and_max_training_predictions_or_responses()
20052005
{
20062006
for (auto &cv_fold_model : cv_fold_models)
20072007
{
2008-
min_training_prediction_or_response = std::max(min_training_prediction_or_response, cv_fold_model.min_training_prediction_or_response);
2009-
max_training_prediction_or_response = std::min(max_training_prediction_or_response, cv_fold_model.max_training_prediction_or_response);
2008+
min_training_prediction_or_response = std::min(min_training_prediction_or_response, cv_fold_model.min_training_prediction_or_response);
2009+
max_training_prediction_or_response = std::max(max_training_prediction_or_response, cv_fold_model.max_training_prediction_or_response);
20102010
}
20112011
}
20122012

cpp/tests.cpp

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ class Tests
115115
save_as_csv_file("data/output.csv", predictions);
116116

117117
std::cout << predictions.mean() << "\n\n";
118-
tests.push_back(is_approximately_equal(predictions.mean(), 19.8552, 0.00001));
118+
tests.push_back(is_approximately_equal(predictions.mean(), 20.0962, 0.00001));
119119

120120
double feature_importance_mean{model.get_feature_importance().mean()};
121121
double term_importance_mean{model.get_term_importance().mean()};
@@ -191,7 +191,7 @@ class Tests
191191
save_as_csv_file("data/output.csv", predictions);
192192

193193
std::cout << predictions.mean() << "\n\n";
194-
tests.push_back(is_approximately_equal(predictions.mean(), 19.2927, 0.00001));
194+
tests.push_back(is_approximately_equal(predictions.mean(), 19.8044, 0.00001));
195195
}
196196

197197
void test_aplrregressor_cauchy()
@@ -245,7 +245,7 @@ class Tests
245245
save_as_csv_file("data/output.csv", predictions);
246246

247247
std::cout << predictions.mean() << "\n\n";
248-
tests.push_back(is_approximately_equal(predictions.mean(), 20.8771, 0.00001));
248+
tests.push_back(is_approximately_equal(predictions.mean(), 20.8736, 0.00001));
249249
}
250250

251251
void test_aplrregressor_custom_loss_and_validation()
@@ -305,7 +305,7 @@ class Tests
305305
save_as_csv_file("data/output.csv", predictions);
306306

307307
std::cout << predictions.mean() << "\n\n";
308-
tests.push_back(is_approximately_equal(predictions.mean(), 30.25, 0.00001));
308+
tests.push_back(is_approximately_equal(predictions.mean(), 23.7554, 0.00001));
309309
}
310310

311311
void test_aplrregressor_custom_loss()
@@ -363,7 +363,7 @@ class Tests
363363
save_as_csv_file("data/output.csv", predictions);
364364

365365
std::cout << predictions.mean() << "\n\n";
366-
tests.push_back(is_approximately_equal(predictions.mean(), 30.25, 0.00001));
366+
tests.push_back(is_approximately_equal(predictions.mean(), 23.7035, 0.00001));
367367
}
368368

369369
void test_aplrregressor_gamma_custom_link()
@@ -418,7 +418,7 @@ class Tests
418418
save_as_csv_file("data/output.csv", predictions);
419419

420420
std::cout << predictions.mean() << "\n\n";
421-
tests.push_back(is_approximately_equal(predictions.mean(), 23.5068, 0.00001));
421+
tests.push_back(is_approximately_equal(predictions.mean(), 23.5266, 0.00001));
422422
}
423423

424424
void test_aplrregressor_gamma_custom_validation()
@@ -473,7 +473,7 @@ class Tests
473473
save_as_csv_file("data/output.csv", predictions);
474474

475475
std::cout << predictions.mean() << "\n\n";
476-
tests.push_back(is_approximately_equal(predictions.mean(), 23.5324, 0.00001));
476+
tests.push_back(is_approximately_equal(predictions.mean(), 23.5512, 0.00001));
477477
}
478478

479479
void test_aplrregressor_gamma_gini_weighted()
@@ -527,7 +527,7 @@ class Tests
527527
save_as_csv_file("data/output.csv", predictions);
528528

529529
std::cout << predictions.mean() << "\n\n";
530-
tests.push_back(is_approximately_equal(predictions.mean(), 23.1358, 0.00001));
530+
tests.push_back(is_approximately_equal(predictions.mean(), 23.3198, 0.00001));
531531
}
532532

533533
void test_aplrregressor_gamma_gini()
@@ -581,7 +581,7 @@ class Tests
581581
save_as_csv_file("data/output.csv", predictions);
582582

583583
std::cout << predictions.mean() << "\n\n";
584-
tests.push_back(is_approximately_equal(predictions.mean(), 23.1358, 0.00001));
584+
tests.push_back(is_approximately_equal(predictions.mean(), 23.3198, 0.00001));
585585
}
586586

587587
void test_aplrregressor_gamma()
@@ -635,7 +635,7 @@ class Tests
635635
save_as_csv_file("data/output.csv", predictions);
636636

637637
std::cout << predictions.mean() << "\n\n";
638-
tests.push_back(is_approximately_equal(predictions.mean(), 23.5324, 0.00001));
638+
tests.push_back(is_approximately_equal(predictions.mean(), 23.5512, 0.00001));
639639
}
640640

641641
void test_aplrregressor_group_mse()
@@ -691,7 +691,7 @@ class Tests
691691
save_as_csv_file("data/output.csv", predictions);
692692

693693
std::cout << predictions.mean() << "\n\n";
694-
tests.push_back(is_approximately_equal(predictions.mean(), 20.8935, 0.00001));
694+
tests.push_back(is_approximately_equal(predictions.mean(), 20.8243, 0.00001));
695695
}
696696

697697
void test_aplrregressor_group_mse_cycle()
@@ -735,7 +735,7 @@ class Tests
735735
save_as_csv_file("data/output.csv", predictions);
736736

737737
std::cout << predictions.mean() << "\n\n";
738-
tests.push_back(is_approximately_equal(predictions.mean(), 23.5048, 0.00001));
738+
tests.push_back(is_approximately_equal(predictions.mean(), 23.5148, 0.00001));
739739
}
740740

741741
void test_aplrregressor_int_constr()
@@ -788,7 +788,7 @@ class Tests
788788
save_as_csv_file("data/output.csv", predictions);
789789

790790
std::cout << predictions.mean() << "\n\n";
791-
tests.push_back(is_approximately_equal(predictions.mean(), 30.25, 0.00001));
791+
tests.push_back(is_approximately_equal(predictions.mean(), 23.5768, 0.00001));
792792
}
793793

794794
void test_aplrregressor_inversegaussian()
@@ -843,7 +843,7 @@ class Tests
843843
save_as_csv_file("data/output.csv", predictions);
844844

845845
std::cout << predictions.mean() << "\n\n";
846-
tests.push_back(is_approximately_equal(predictions.mean(), 23.3027, 0.00001));
846+
tests.push_back(is_approximately_equal(predictions.mean(), 23.3198, 0.00001));
847847
}
848848

849849
void test_aplrregressor_logit()
@@ -896,7 +896,7 @@ class Tests
896896
save_as_csv_file("data/output.csv", predictions);
897897

898898
std::cout << predictions.mean() << "\n\n";
899-
tests.push_back(is_approximately_equal(predictions.mean(), 0.0849744, 0.00001));
899+
tests.push_back(is_approximately_equal(predictions.mean(), 0.0875969, 0.00001));
900900
}
901901

902902
void test_aplrregressor_mae()
@@ -949,7 +949,7 @@ class Tests
949949
save_as_csv_file("data/output.csv", predictions);
950950

951951
std::cout << predictions.mean() << "\n\n";
952-
tests.push_back(is_approximately_equal(predictions.mean(), 23.5348, 0.00001));
952+
tests.push_back(is_approximately_equal(predictions.mean(), 23.5419, 0.00001));
953953
}
954954

955955
void test_aplrregressor_monotonic()
@@ -1002,7 +1002,7 @@ class Tests
10021002
save_as_csv_file("data/output.csv", predictions);
10031003

10041004
std::cout << predictions.mean() << "\n\n";
1005-
tests.push_back(is_approximately_equal(predictions.mean(), 30.25, 0.00001));
1005+
tests.push_back(is_approximately_equal(predictions.mean(), 23.476, 0.00001));
10061006
}
10071007

10081008
void test_aplrregressor_monotonic_ignore_interactions()
@@ -1056,7 +1056,7 @@ class Tests
10561056
save_as_csv_file("data/output.csv", predictions);
10571057

10581058
std::cout << predictions.mean() << "\n\n";
1059-
tests.push_back(is_approximately_equal(predictions.mean(), 30.25, 0.00001));
1059+
tests.push_back(is_approximately_equal(predictions.mean(), 24.3013, 0.00001));
10601060
}
10611061

10621062
void test_aplrregressor_negative_binomial()
@@ -1110,7 +1110,7 @@ class Tests
11101110
save_as_csv_file("data/output.csv", predictions);
11111111

11121112
std::cout << predictions.mean() << "\n\n";
1113-
tests.push_back(is_approximately_equal(predictions.mean(), 1.86873, 0.00001));
1113+
tests.push_back(is_approximately_equal(predictions.mean(), 1.8694, 0.00001));
11141114
}
11151115

11161116
void test_aplrregressor_poisson()
@@ -1163,7 +1163,7 @@ class Tests
11631163
save_as_csv_file("data/output.csv", predictions);
11641164

11651165
std::cout << predictions.mean() << "\n\n";
1166-
tests.push_back(is_approximately_equal(predictions.mean(), 1.89258, 0.00001));
1166+
tests.push_back(is_approximately_equal(predictions.mean(), 1.88727, 0.00001));
11671167
}
11681168

11691169
void test_aplrregressor_poissongamma()
@@ -1217,7 +1217,7 @@ class Tests
12171217
save_as_csv_file("data/output.csv", predictions);
12181218

12191219
std::cout << predictions.mean() << "\n\n";
1220-
tests.push_back(is_approximately_equal(predictions.mean(), 1.88972, 0.00001));
1220+
tests.push_back(is_approximately_equal(predictions.mean(), 1.88553, 0.00001));
12211221
}
12221222

12231223
void test_aplrregressor_quantile()
@@ -1270,7 +1270,7 @@ class Tests
12701270
save_as_csv_file("data/output.csv", predictions);
12711271

12721272
std::cout << predictions.mean() << "\n\n";
1273-
tests.push_back(is_approximately_equal(predictions.mean(), 23.6396, 0.00001));
1273+
tests.push_back(is_approximately_equal(predictions.mean(), 23.649, 0.00001));
12741274
}
12751275

12761276
void test_aplrregressor_weibull()
@@ -1324,7 +1324,7 @@ class Tests
13241324
save_as_csv_file("data/output.csv", predictions);
13251325

13261326
std::cout << predictions.mean() << "\n\n";
1327-
tests.push_back(is_approximately_equal(predictions.mean(), 23.6046, 0.00001));
1327+
tests.push_back(is_approximately_equal(predictions.mean(), 23.6406, 0.00001));
13281328
}
13291329

13301330
void test_aplrregressor()
@@ -1380,7 +1380,7 @@ class Tests
13801380
save_as_csv_file("data/output.csv", predictions);
13811381

13821382
std::cout << predictions.mean() << "\n\n";
1383-
tests.push_back(is_approximately_equal(predictions.mean(), 30.25, 0.00001));
1383+
tests.push_back(is_approximately_equal(predictions.mean(), 23.7035, 0.00001));
13841384

13851385
std::map<double, double> coefficient_shape_function = model.get_coefficient_shape_function(1);
13861386
bool coefficient_shape_function_has_correct_length{coefficient_shape_function.size() == 27};
@@ -1461,15 +1461,15 @@ class Tests
14611461

14621462
std::cout << "cv_error\n"
14631463
<< model.get_cv_error() << "\n\n";
1464-
tests.push_back(is_approximately_equal(model.get_cv_error(), 0.246476719, 0.000001));
1464+
tests.push_back(is_approximately_equal(model.get_cv_error(), 0.246477, 0.000001));
14651465

14661466
std::cout << "predicted_class_prob_mean\n"
14671467
<< predicted_class_probabilities.mean() << "\n\n";
14681468
tests.push_back(is_approximately_equal(predicted_class_probabilities.mean(), 0.2, 0.00001));
14691469

14701470
std::cout << "local_feature_importance_mean\n"
14711471
<< local_feature_importance.mean() << "\n\n";
1472-
tests.push_back(is_approximately_equal(local_feature_importance.mean(), 0.15805047, 0.00001));
1472+
tests.push_back(is_approximately_equal(local_feature_importance.mean(), 0.15805, 0.00001));
14731473
}
14741474

14751475
void test_aplrclassifier_multi_class()
@@ -1544,15 +1544,15 @@ class Tests
15441544

15451545
std::cout << "validation_error\n"
15461546
<< model.get_cv_error() << "\n\n";
1547-
tests.push_back(is_approximately_equal(model.get_cv_error(), 0.22771659413507309, 0.000001));
1547+
tests.push_back(is_approximately_equal(model.get_cv_error(), 0.227717, 0.000001));
15481548

15491549
std::cout << "predicted_class_prob_mean\n"
15501550
<< predicted_class_probabilities.mean() << "\n\n";
15511551
tests.push_back(is_approximately_equal(predicted_class_probabilities.mean(), 0.2, 0.00001));
15521552

15531553
std::cout << "local_feature_importance_mean\n"
15541554
<< local_feature_importance.mean() << "\n\n";
1555-
tests.push_back(is_approximately_equal(local_feature_importance.mean(), 0.15462763289863407, 0.00001));
1555+
tests.push_back(is_approximately_equal(local_feature_importance.mean(), 0.154628, 0.00001));
15561556
}
15571557

15581558
void test_aplrclassifier_two_class_other_params()
@@ -1614,15 +1614,15 @@ class Tests
16141614

16151615
std::cout << "cv_error\n"
16161616
<< model.get_cv_error() << "\n\n";
1617-
tests.push_back(is_approximately_equal(model.get_cv_error(), 0.29875044672505785, 0.000001));
1617+
tests.push_back(is_approximately_equal(model.get_cv_error(), 0.29875, 0.000001));
16181618

16191619
std::cout << "predicted_class_prob_mean\n"
16201620
<< predicted_class_probabilities.mean() << "\n\n";
16211621
tests.push_back(is_approximately_equal(predicted_class_probabilities.mean(), 0.5, 0.00001));
16221622

16231623
std::cout << "local_feature_importance_mean\n"
16241624
<< local_feature_importance.mean() << "\n\n";
1625-
tests.push_back(is_approximately_equal(local_feature_importance.mean(), 0.15288015457447063, 0.00001));
1625+
tests.push_back(is_approximately_equal(local_feature_importance.mean(), 0.15288, 0.00001));
16261626
}
16271627

16281628
void test_aplrclassifier_two_class_val_index()
@@ -1683,15 +1683,15 @@ class Tests
16831683

16841684
std::cout << "cv_error\n"
16851685
<< model.get_cv_error() << "\n\n";
1686-
tests.push_back(is_approximately_equal(model.get_cv_error(), 0.27830802806385846, 0.000001));
1686+
tests.push_back(is_approximately_equal(model.get_cv_error(), 0.278308, 0.000001));
16871687

16881688
std::cout << "predicted_class_prob_mean\n"
16891689
<< predicted_class_probabilities.mean() << "\n\n";
16901690
tests.push_back(is_approximately_equal(predicted_class_probabilities.mean(), 0.5, 0.00001));
16911691

16921692
std::cout << "local_feature_importance_mean\n"
16931693
<< local_feature_importance.mean() << "\n\n";
1694-
tests.push_back(is_approximately_equal(local_feature_importance.mean(), 0.12155125799010527, 0.00001));
1694+
tests.push_back(is_approximately_equal(local_feature_importance.mean(), 0.121551, 0.00001));
16951695
}
16961696

16971697
void test_aplrclassifier_two_class()
@@ -1751,15 +1751,15 @@ class Tests
17511751

17521752
std::cout << "cv_error\n"
17531753
<< model.get_cv_error() << "\n\n";
1754-
tests.push_back(is_approximately_equal(model.get_cv_error(), 0.16491496201017047, 0.000001));
1754+
tests.push_back(is_approximately_equal(model.get_cv_error(), 0.164915, 0.000001));
17551755

17561756
std::cout << "predicted_class_prob_mean\n"
17571757
<< predicted_class_probabilities.mean() << "\n\n";
17581758
tests.push_back(is_approximately_equal(predicted_class_probabilities.mean(), 0.5, 0.00001));
17591759

17601760
std::cout << "local_feature_importance_mean\n"
17611761
<< local_feature_importance.mean() << "\n\n";
1762-
tests.push_back(is_approximately_equal(local_feature_importance.mean(), 0.12567194593990993, 0.00001));
1762+
tests.push_back(is_approximately_equal(local_feature_importance.mean(), 0.125672, 0.00001));
17631763
}
17641764

17651765
void test_functions()

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
setuptools.setup(
2323
name="aplr",
24-
version="9.2.2",
24+
version="9.2.3",
2525
description="Automatic Piecewise Linear Regression",
2626
ext_modules=[sfc_module],
2727
author="Mathias von Ottenbreit",

0 commit comments

Comments
 (0)