from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import itertools

from tensorflow.compat.v1 import flags
from absl.testing import absltest
from absl.testing import parameterized
from experiments.drebin_ood import run_experiment, feature_type_scope_dict, ensemble_method_scope_dict

flags.DEFINE_integer('n_members', 1,
                     'The number of members for deep ensemble, weighted deep ensemble, and anchor ensemble')
flags.DEFINE_integer('proc_numbers', 2,
                     'The number of threads for features extraction')


# feature_types = feature_type_scope_dict.keys()
# ensemble_types = ensemble_method_scope_dict.keys()
feature_types = ['dex2img']  # 'drebin', 'opcodeseq', 'multimodality',
ensemble_types = ['bayesian']


class TestOODExperiments(parameterized.TestCase):
    @parameterized.named_parameters(
        [('%s_%s' % p,) + p for p in itertools.product(feature_types, ensemble_types)])
    def test_run(self, feature, ensemble):
        print('testing:', feature, ensemble)
        run_experiment(feature, ensemble, flags.FLAGS.n_members, flags.FLAGS.proc_numbers)


if __name__ == '__main__':
    absltest.main()
