mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-03-22 15:20:39 +01:00
[test/regression] Add a logistic test
This commit is contained in:
@@ -99,11 +99,18 @@ QUIZ_CASE(power_regression) {
|
||||
|
||||
// No case for trigonometric regression, because it has no unique solution
|
||||
|
||||
/* This data was generated without the random error, otherwise it did not pass
|
||||
* the test. */
|
||||
|
||||
QUIZ_CASE(logistic_regression) {
|
||||
double x[] = {2.3, 5.6, 1.1, 4.3};
|
||||
double y[] = {3.948, 4.694, 2.184, 4.656};
|
||||
double coefficients[] = {6, 1.5, 4.7};
|
||||
assert_regression_is(x, y, 4, Model::Type::Logistic, coefficients);
|
||||
/* This data was generated without the random error, otherwise it did not pass
|
||||
* the test. */
|
||||
double x1[] = {2.3, 5.6, 1.1, 4.3};
|
||||
double y1[] = {3.948, 4.694, 2.184, 4.656};
|
||||
double coefficients1[] = {6, 1.5, 4.7};
|
||||
assert_regression_is(x1, y1, 4, Model::Type::Logistic, coefficients1);
|
||||
|
||||
// This data produced a wrong fit before
|
||||
double x2[] = {0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0};
|
||||
double y2[] = {5.0, 9.0, 40.0, 64.0, 144.0, 200.0, 269.0, 278.0, 290.0, 295.0};
|
||||
double coefficients2[] = {64.9, 1.0, 297.4};
|
||||
assert_regression_is(x2, y2, 10, Model::Type::Logistic, coefficients2);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user