def test_builds_instance_with_proper_args(self): dummy = u.build(Dummy, a=3, b=6) assert dummy.a == 3 assert dummy.b == 6 dummy = u.build(Dummy, a=3) assert dummy.a == 3 assert dummy.b == 5
def make_specialized_selector(name, n_features, **kwargs): """Create a selector by name (gmm, outlier or auto)""" if name == 'auto': name = 'gmm' if n_features > 250 else 'outlier' filter_cls = { 'gmm': HighAbundanceAndVarianceSelector, 'outlier': OutlierAbundanceAndVarianceSelector, 'none': NoSelector, }[name] return build(filter_cls, **kwargs)
def make_specialized_selector(name, n_features, **kwargs): """Create a selector by name (``gmm``, ``outlier``, ``none`` or ``auto``) ``auto`` switches to ``gmm`` if there is more than 250 features, ``outlier`` below. """ if name == "auto": name = "gmm" if n_features > 250 else "outlier" filter_cls = { "gmm": HighAbundanceAndVarianceSelector, "outlier": OutlierAbundanceAndVarianceSelector, "none": NoSelector, }[name] return build(filter_cls, **kwargs)
def main(): data, config, destination, xy = sc.initialize() logging.info('Workspace initialized.') logging.info('Scenario configuration: {0}'.format(config)) fast = _fast_kmeans(**config) full = _full_kmeans(**config) divik_config = {'kmeans': full, 'fast_kmeans': fast, **config} divik = build(DiviK, **divik_config) logging.info("Launching experiment.") try: divik.fit(data) except Exception as ex: logging.error("Failed with exception.") logging.error(repr(ex)) raise save(data, divik, destination, xy)
def test_builds_with_too_many_args(self): dummy = u.build(Dummy, a=3, c=4) assert dummy.a == 3 assert dummy.b == 5