8000 BAMT/tests at golem-to-deap · aimclub/BAMT · GitHub
[go: up one dir, main page]

Skip to content

Latest commit

 

History

History
 
 

tests

README.md

Testing module

We have made unit tests for BAMT!

Integration tests will be soon!

The key difference between integration test and unit test are this: at the first one all modules of the software are tested combined, at the second - each module of the software is tested separately.

Basic usage

There are two ways to use these unit tests: with pytest and unittest.

Pytest

First, navigate to the BAMT directory.
Then, run pytest with verbosity mode or without:
Verbosity: pytest -v -s tests
Without: pytest -s tests

Unittest

First, navigate to the BAMT directory.
Then, run unittest with verbosity mode or without:
Verbosity: python -m unittest discover -v -s tests
Without: python -m unittest discover -s tests

Description of integration tests

The following features have been covered:

  • Discrete BN and Continuous BN
    • Preprocessing
    • Structure learning
    • Parameters learning
    • Sample
    • In these cases we just compare a result of network trained in a new version with pretrained one in a stable version by structure (nodes, edges) and parameters (distributions).

  • Hybrid BN
  • With this type of BN not entire net can be compared, parameters diverge. Thus, we use rules. They are assertions with any feature we want to compare.
    • Preprocessing
    • Structure learning
    • Parameters learning
      • Non Empty Rule
      • Sum of coefficients equals to 1.
      • Coefficients of a model/combination (MixtureGaussian, ConditionalMixtureGaussian, respectively)
    • Sample

How to add a new test

Flowcharts

How to write and use rules

In order to write new rule we need to write a wrapper for use_rules(...) with the rule itself.
The assertion inside must be with assert construction (or write if-else condition with raise AssertionError).

Then pass your wrapper inside test as static method (if needed), and use method use_rules(self.rule1, self.rule2, data=data, something_else=else). Note that if all rules accept the same arguments, you can use this function. Otherwise, you need to call use_rule for each rule.

0