Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change-point tests #1295

Draft
wants to merge 85 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
85 commits
Select commit Hold shift + click to select a range
23a69ac
#1294 functional test HaarioBardenet
DavAug Feb 16, 2021
b852dd3
@1294 add copyright notice
DavAug Feb 16, 2021
4e5bef1
#1294 exclude functional tests from coverage rep
DavAug Feb 16, 2021
6e36010
#1294 add copyright notice
DavAug Feb 16, 2021
5986250
#1294 flake8
DavAug Feb 16, 2021
3bc6fee
Make test importable
fcooper8472 Feb 22, 2021
d297099
Return a string of the class name
fcooper8472 Feb 22, 2021
5e14e66
Add skeleton for functional testing workflow
fcooper8472 Feb 22, 2021
a1be118
Merge branch 'master' into issue-1294-functional-testing-module
fcooper8472 Feb 22, 2021
29d52f7
I think this is the correct syntax for not running on draft pr...
fcooper8472 Feb 22, 2021
d176527
Try committing changes to functional testing
fcooper8472 Feb 22, 2021
6f14364
Fix syntax
fcooper8472 Feb 22, 2021
36aa00b
Remove diff
fcooper8472 Feb 22, 2021
128f66e
Bump
fcooper8472 Feb 23, 2021
2c360e7
Bump
fcooper8472 Feb 23, 2021
d28387d
Bump
fcooper8472 Feb 23, 2021
fdbf30d
#1294 update structure
fcooper8472 Mar 15, 2021
1225905
#1294 allow setting of hyper parameters
fcooper8472 Mar 16, 2021
09af996
Added banana problem
ben18785 Mar 22, 2021
f42b5cf
Added gaussian and banana tests for differential evolution
ben18785 Mar 22, 2021
774d460
Moved controller initialisation methods to parent class
ben18785 Mar 23, 2021
6d8c553
Added dream
ben18785 Mar 23, 2021
63a674d
Added Haario to functional tests
ben18785 Mar 23, 2021
d3d8f41
added functional tests for emcee hammer
ben18785 Mar 23, 2021
d076b1a
Added sample sizes as optional parameter for tests
ben18785 Mar 23, 2021
e9fd8ab
Added high dim Gaussian problem
ben18785 Mar 24, 2021
25be93f
Merge branch 'master' into issue-1294-functional-testing-module
ben18785 Apr 19, 2021
4f4b9ea
Added nuts problems
ben18785 Apr 19, 2021
73c8a8c
Added correlated Gaussian and started to add DRAM but found a bug
ben18785 Apr 20, 2021
7bdef09
Added banana test for dram
ben18785 Apr 20, 2021
8f528d2
Simplified starting points for problems.
ben18785 Apr 20, 2021
7f57caf
Added correlated Gaussian test for haario-bardenet
ben18785 Apr 20, 2021
d9ef3c6
Corrected func test name for haario bardenet
ben18785 Apr 20, 2021
8429f10
Update haario_bardenet_acmc.py
ben18785 Apr 20, 2021
88a4803
Added annulus problem for Haario-bardenet
ben18785 Apr 20, 2021
d1b0c9a
expose some more functional tests
fcooper8472 Apr 26, 2021
ac0bf23
bump
fcooper8472 Apr 26, 2021
e580c62
Merge branch 'master' into issue-1294-functional-testing-module
ben18785 May 4, 2021
7a7d9ab
Added problems for emcee hammer
ben18785 May 4, 2021
81436e0
Added cone problem
ben18785 May 4, 2021
8ae5c5f
Added monomial gamma problems
ben18785 May 5, 2021
9e48d20
Delete empty ending line
chonlei May 25, 2021
5eccd57
Rename to haario_acmc.py and add correlated Gaussian problem
chonlei May 25, 2021
20adc16
add correlated gaussian and annulus to differential evolution functests
rccreswell May 28, 2021
de66391
add correlated gaussian and annulus to dream functests
rccreswell May 31, 2021
d55f7d2
Add problems for Metropolis functests
chonlei Aug 10, 2021
494574f
add relativistic problems
rccreswell Aug 10, 2021
aa55906
Functional testing for slice stepout
FarmHJ Aug 10, 2021
3b0f961
update relativistic functional test hyperparameters
rccreswell Aug 10, 2021
6212de2
Merge branch 'issue-1294-functional-testing-module' of https://github…
rccreswell Aug 10, 2021
033f29e
Merge branch 'master' into issue-1294-functional-testing-module
MichaelClerx Aug 10, 2021
24603ab
Updated tests for Population MCMC.
MichaelClerx Aug 11, 2021
f1f3fda
Made all functional test classes modules have names that match the me…
MichaelClerx Aug 11, 2021
30d4e44
Removed 'test_method_on' prefix from all functional tests, so they ca…
MichaelClerx Aug 11, 2021
e029413
Updated the way functionaltest modules and problem classes are imported.
MichaelClerx Aug 11, 2021
c83bfc3
Removed 'from __future__' imports.
MichaelClerx Aug 11, 2021
3edbeb1
Added docstrings to functional tests.
MichaelClerx Aug 11, 2021
3b0e026
Updated way iterations and warmup is set in functional tests.
MichaelClerx Aug 11, 2021
c9cb226
Added functional test discovery mechanism.
MichaelClerx Aug 11, 2021
32033d5
Add MALA methods
fcooper8472 Aug 12, 2021
c3d98dc
Merge pull request #1388 from pints-team/mala
ben18785 Aug 16, 2021
325a674
Merge branch 'issue-1294-functional-testing-module' into func-test-or…
MichaelClerx Aug 16, 2021
6c8f607
Updated new MALA tests.
MichaelClerx Aug 16, 2021
1e434c5
Updated new MALA tests.
MichaelClerx Aug 16, 2021
14c0263
Made ft warmup a user-set parameter.
MichaelClerx Aug 16, 2021
2ed963f
Slightly simplified ft code.
MichaelClerx Aug 16, 2021
e89e2ba
Merge pull request #1386 from pints-team/func-test-organising
MichaelClerx Aug 17, 2021
4d757a3
Renamed function to change point tests. Closes #1391.
MichaelClerx Aug 17, 2021
6247830
Merge branch 'master' into issue-1294-functional-testing-module
MichaelClerx Aug 17, 2021
0fcd400
Changed 'ft' to 'cpt'.
MichaelClerx Aug 24, 2021
9aa1592
Added flag to ignore unused import in cptests.__init__
MichaelClerx Aug 24, 2021
a602921
Merge pull request #1392 from pints-team/func-test-rename
MichaelClerx Aug 24, 2021
665f21c
Fixed merge issue in workflows.
MichaelClerx Aug 24, 2021
b54bf9a
Updated workflow
MichaelClerx Aug 24, 2021
12e7e67
Disabled `banana` & added `annulus` in `hamiltonian_mcmc`.
YongchaoHuang Dec 5, 2023
e2e3969
Merge pull request #1510 from pints-team/main
MichaelClerx Dec 12, 2023
8275e17
Style fix and hmc cptest fix
MichaelClerx Dec 12, 2023
ad9e422
Remove banana and multimodal gaussian problem for slice stepout mcmc
FarmHJ Dec 12, 2023
66e58f3
Add problems for functional test of slice doubling
FarmHJ Dec 12, 2023
3b2864d
Added optimiser problems and tests on CMAES
MichaelClerx Dec 14, 2023
6bb0255
Added cmaes-bare cptests
MichaelClerx Dec 14, 2023
6970872
Added xNES tests (requires fix from #1517).
MichaelClerx Jan 2, 2024
0294abc
Added SNES tests
MichaelClerx Jan 2, 2024
f7e6b6b
Add test for HMC
FarmHJ Apr 9, 2024
3e169ba
Merge branch 'issue-1294-functional-testing-module' of https://github…
FarmHJ Apr 9, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
source = pints
omit =
pints/tests/*
pints/functionaltests/*

[report]
exclude_lines =
Expand Down
58 changes: 58 additions & 0 deletions .github/workflows/change-point-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: Change-point testing

on:
push:
branches:
- issue-1294-functional-testing-module

jobs:

run-functional-testing:
name: Change-point testing
runs-on: ubuntu-latest

steps:
- name: Check out PINTS repository
uses: actions/checkout@v2
with:
path: 'pints'

- name: Check out functional-testing-2 repository
uses: actions/checkout@v2
with:
repository: 'pints-team/functional-testing-2'
ref: 'new-infra'
path: 'functional-testing-2'
token: ${{ secrets.FUNCTIONAL_TESTING_TOKEN }}

- name: Set up Python 3.8
uses: actions/setup-python@v1
with:
python-version: 3.8
architecture: x64

- name: install pints
run: |
python --version
python -m pip install --upgrade pip setuptools wheel
python -m pip install .
working-directory: 'pints'

- name: install functional-testing-2
run: |
python -m pip install .
working-directory: 'functional-testing-2'

- name: run change-point testing
run: |
python run_all_the_things.py
working-directory: 'functional-testing-2'

- name: commit changes
run: |
git config user.name "github-workflow"
git config user.email "github-workflow"
git add --all
git commit -m "Run of change-point testing" || echo "No changes to commit"
git push
working-directory: 'functional-testing-2'
52 changes: 52 additions & 0 deletions pints/cptests/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
#
# Change point tests for PINTS.
#
# This file is part of PINTS (https://github.com/pints-team/pints/) which is
# released under the BSD 3-clause license. See accompanying LICENSE.md for
# copyright notice and full license details.
#

# Import all problem classes straight into this module, so that they can be
# addressed as e.g. pints.cptests.RunMcmcMethodOnAnnulus.
from ._problems import ( # noqa
RunMcmcMethodOnAnnulus,
RunMcmcMethodOnBanana,
RunMcmcMethodOnCone,
RunMcmcMethodOnCorrelatedGaussian,
RunMcmcMethodOnHighDimensionalGaussian,
RunMcmcMethodOnMultimodalGaussian,
RunMcmcMethodOnProblem,
RunMcmcMethodOnTwoDimGaussian,
RunOptimiserOnBoundedFitzhughNagumo,
RunOptimiserOnBoundedUntransformedLogistic,
RunOptimiserOnProblem,
RunOptimiserOnRosenbrockError,
RunOptimiserOnTwoDimParabola,
)

# Import all test modules (not methods!) directly into this method, so that
# they can be addressed as e.g.
# pints.cptests.dram_acmc.two_dim_gaussian().
from . import ( # noqa
cmaes,
cmaes_bare,
differential_evolution_mcmc,
dram_acmc,
dream_mcmc,
emcee_hammer_mcmc,
haario_acmc,
haario_bardenet_acmc,
hamiltonian_mcmc,
mala_mcmc,
metropolis_random_walk_mcmc,
monomial_gamma_hamiltonian_mcmc,
no_u_turn_mcmc,
population_mcmc,
relativistic_mcmc,
slice_stepout_mcmc,
slice_doubling_mcmc,
)


# Test discovery methods
from ._discovery import tests # noqa
40 changes: 40 additions & 0 deletions pints/cptests/_discovery.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#
# Change point test discovery methods for PINTS.
#
# This file is part of PINTS (https://github.com/pints-team/pints/) which is
# released under the BSD 3-clause license. See accompanying LICENSE.md for
# copyright notice and full license details.
#
import inspect

import pints.cptests as cpt


def tests(method=None):
"""
Returns a list of all change point tests, each represented as a tuple
``(method, test)`` where ``method`` is the PINTS class being tested and
``test`` is a callable that returns the test results.

If the optional argument ``method`` is given, only tests for this method
are returned.
"""
# Get all modules imported into this module
modules = [getattr(cpt, x) for x in dir(cpt) if not x.startswith('_')]
modules = [x for x in modules if inspect.ismodule(x)]

# Look for (explicitly defined) tests
tests = []
for module in modules:
try:
m_method = module._method
m_tests = module._change_point_tests
except AttributeError:
continue

if method is None or method == m_method:
for test in m_tests:
tests.append((m_method, test))

return tests

Loading
Loading