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.
There are two ways to use these unit tests: with pytest and unittest.
First, navigate to the BAMT directory.
Then, run pytest with verbosity mode or without:
Verbosity: pytest -v -s tests
Without: pytest -s tests
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
The following features have been covered:
- Discrete BN and Continuous BN
- Preprocessing
- Structure learning
- Parameters learning
- Sample
- 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
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).
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.