Пример #1
0
 def learn_inc(_data, _labels, _i, _k, _h):
     # strategy = OneClassStrategy(RandomViolationsStrategy(10), thresholds)
     strategy = RandomViolationsStrategy(10)
     learner = KCnfSmtLearner(_k, _h, strategy, "mvn")
     initial_indices = LearnOptions.initial_random(20)(list(range(len(_data))))
     learner.add_observer(PlottingObserver(domain, directory, "run_{}_{}_{}".format(_i, _k, _h),
                                           domain.real_vars[0], domain.real_vars[1], None, False))
     return learner.learn(domain, _data, _labels, initial_indices)
Пример #2
0
    def learn_inc(_data, _labels, _i, _k, _h):
        strategy = OneClassStrategy(RandomViolationsStrategy(10), thresholds,
                                    background_knowledge=bg_knowledge)
        if negative_bootstrap > 0:
            _data, _labels = OneClassStrategy.add_negatives(domain, _data, _labels, thresholds, negative_bootstrap)

        learner = KCnfSmtLearner(_k, _h, strategy, symmetry_breaking)

        random.seed(seed)        
        initial_indices = LearnOptions.initial_random(20)(list(range(len(_data))))
        res = learner.learn(domain, _data, _labels, initial_indices)
        return res
Пример #3
0
 def learn_inc(_data, _labels, _i, _k, _h):
     strategy = OneClassStrategy(
         RandomViolationsStrategy(10),
         thresholds)  #, background_knowledge=(a | b) & (~a | ~b))
     learner = KCnfSmtLearner(_k, _h, strategy, "mvn")
     initial_indices = LearnOptions.initial_random(20)(list(
         range(len(_data))))
     # learner.add_observer(LoggingObserver(None, _k, _h, None, True))
     learner.add_observer(
         PlottingObserver(domain, "test_output/bg",
                          "run_{}_{}_{}".format(_i, _k,
                                                _h), domain.real_vars[0],
                          domain.real_vars[1], None, False))
     return learner.learn(domain, _data, _labels, initial_indices)