Skip to content

matrix and array ad tests to framework - #1424

Merged
rok-cesnovar merged 130 commits into
developfrom
feature/1412-matrix-ad-tests
Nov 5, 2019
Merged

rok-cesnovar merged 130 commits into
developfrom
feature/1412-matrix-ad-tests

Conversation

@bob-carpenter

@bob-carpenter bob-carpenter commented Oct 27, 2019 •

Copy link
Copy Markdown
Member

Summary

This improves test coverage by converting all real-valued functions of two or fewer arguments to the autodiff test framework. The full list is in issue #1412. Many of these did not have one or more of reverse, forward, or mixed mode tests and many more had poor coverage of types or boundary conditions.

This PR also adds convenience methods to the autodiff test framework in test/unit/math/test_ad.hpp for converting among types and testing exceptions.

Tests

Old test inputs were used for new tests. New tests were generated for boundary condition sizes and to cover all types. Each new test runs at each level of autodiff.

The tests in mix have complete coverage, so those in fwd and rev were removed.

Side Effects

No.

Checklist

  • Math issue #(issue number)

  • Copyright holder: (fill in copyright holder information)

Columbia University

The copyright holder is typically you or your assignee, such as a university or company. By submitting this pull request, the copyright holder is agreeing to the license the submitted work under the following licenses:
  - Code: BSD 3-clause (https://opensource.org/licenses/BSD-3-Clause)
  - Documentation: CC-BY 4.0 (https://creativecommons.org/licenses/by/4.0/)
  • the basic tests are passing

    • unit tests pass (to run, use: ./runTests.py test/unit)
    • header checks pass, (make test-headers)
    • docs build, (make doxygen)
    • code passes the built in C++ standards checks (make cpplint)
  • the code is written in idiomatic C++ and changes are documented in the doxygen

  • the new changes are tested

@stan-buildbot

Copy link
Copy Markdown
Contributor

(stat_comp_benchmarks/benchmarks/gp_pois_regr/gp_pois_regr.stan, 1.0)
(stat_comp_benchmarks/benchmarks/low_dim_corr_gauss/low_dim_corr_gauss.stan, 0.99)
(stat_comp_benchmarks/benchmarks/irt_2pl/irt_2pl.stan, 1.0)
(stat_comp_benchmarks/benchmarks/pkpd/one_comp_mm_elim_abs.stan, 1.0)
(stat_comp_benchmarks/benchmarks/eight_schools/eight_schools.stan, 1.01)
(stat_comp_benchmarks/benchmarks/gp_regr/gp_regr.stan, 0.99)
(stat_comp_benchmarks/benchmarks/arK/arK.stan, 1.0)
(performance.compilation, 1.02)
(stat_comp_benchmarks/benchmarks/low_dim_gauss_mix_collapse/low_dim_gauss_mix_collapse.stan, 1.0)
(stat_comp_benchmarks/benchmarks/low_dim_gauss_mix/low_dim_gauss_mix.stan, 1.0)
(stat_comp_benchmarks/benchmarks/sir/sir.stan, 1.07)
(stat_comp_benchmarks/benchmarks/pkpd/sim_one_comp_mm_elim_abs.stan, 0.97)
(stat_comp_benchmarks/benchmarks/garch/garch.stan, 1.0)
(stat_comp_benchmarks/benchmarks/gp_regr/gen_gp_data.stan, 0.97)
(stat_comp_benchmarks/benchmarks/arma/arma.stan, 1.0)
Result: 1.00167917177
Commit hash: d00ab7a

@rok-cesnovar

Copy link
Copy Markdown
Member

I started reviewing this one. Just posting here so we dont duplicate any efforts. Will probably take me some time.

@bob-carpenter

bob-carpenter commented Oct 29, 2019 via email

Copy link
Copy Markdown
Member Author

@rok-cesnovar rok-cesnovar left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is fantastic stuff and it was a ton of work! I really dont have any major comments.

The only minor comment that I think should be addressed is the use of boost::promote_args that should be replaced by our type trait return_type_t. I know that there are a few places in Math where we still use boost::promote args directly, but we did mostly clean it up.

The other one is zero-sized input tests. Some of them are missing and they were already missing before so this may be out of scope of this PR. If you feel so, I will make a separate issue with the files I flagged here. I figured if I am already going through might as well check & flag that.

Comment thread test/unit/math/mix/scal/fun/ub_constrain_test.cpp Outdated
Comment thread test/unit/math/mix/mat/fun/add_test.cpp
Comment thread test/unit/math/mix/mat/fun/corr_matrix_constrain_test.cpp Outdated
Comment thread test/unit/math/mix/mat/fun/cov_matrix_constrain_test.cpp
Comment thread test/unit/math/mix/mat/fun/crossprod_test.cpp
Comment thread test/unit/math/mix/mat/fun/sub_row_test.cpp
Comment thread test/unit/math/mix/mat/fun/subtract_test.cpp
Comment thread test/unit/math/mix/mat/fun/trace_inv_quad_form_ldlt_test.cpp
Comment thread test/unit/math/mix/mat/fun/trace_quad_form_test.cpp
Comment thread test/unit/math/mix/scal/fun/lb_constrain_test.cpp Outdated
@bob-carpenter

bob-carpenter commented Oct 31, 2019 via email

Copy link
Copy Markdown
Member Author

@rok-cesnovar

Copy link
Copy Markdown
Member

Yeah, the boundaries should be done with separate PRs. I will approve once the promote_args are changed.

@bob-carpenter

Copy link
Copy Markdown
Member Author

This is ready to be reviewed again when tests pass.

I didn't mean to start reviews, but don't know how to get rid of all the junk in GitHub. Sorry about that. I resolved all the issues raised by @rok-cesnovar either by adding boundary condition tests or submitting a new issue for Stan math for ones that aren't consistent.

@stan-buildbot

Copy link
Copy Markdown
Contributor

(stat_comp_benchmarks/benchmarks/gp_pois_regr/gp_pois_regr.stan, 1.01)
(stat_comp_benchmarks/benchmarks/low_dim_corr_gauss/low_dim_corr_gauss.stan, 0.97)
(stat_comp_benchmarks/benchmarks/irt_2pl/irt_2pl.stan, 1.0)
(stat_comp_benchmarks/benchmarks/pkpd/one_comp_mm_elim_abs.stan, 0.98)
(stat_comp_benchmarks/benchmarks/eight_schools/eight_schools.stan, 0.98)
(stat_comp_benchmarks/benchmarks/gp_regr/gp_regr.stan, 1.0)
(stat_comp_benchmarks/benchmarks/arK/arK.stan, 1.0)
(performance.compilation, 1.03)
(stat_comp_benchmarks/benchmarks/low_dim_gauss_mix_collapse/low_dim_gauss_mix_collapse.stan, 0.97)
(stat_comp_benchmarks/benchmarks/low_dim_gauss_mix/low_dim_gauss_mix.stan, 1.01)
(stat_comp_benchmarks/benchmarks/sir/sir.stan, 1.0)
(stat_comp_benchmarks/benchmarks/pkpd/sim_one_comp_mm_elim_abs.stan, 1.04)
(stat_comp_benchmarks/benchmarks/garch/garch.stan, 1.0)
(stat_comp_benchmarks/benchmarks/gp_regr/gen_gp_data.stan, 1.01)
(stat_comp_benchmarks/benchmarks/arma/arma.stan, 1.0)
Result: 1.00053230874
Commit hash: 8f61b51

@rok-cesnovar rok-cesnovar left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great!

Thank you very much for creating all those issues.

@rok-cesnovar
rok-cesnovar merged commit e126bcc into develop Nov 5, 2019
@syclik
syclik deleted the feature/1412-matrix-ad-tests branch November 7, 2019 05:12
@t4c1 t4c1 mentioned this pull request Aug 18, 2020
4 of 5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants