Exemplo n.º 1
0
    def __init__(self,
                 unlabeled_datasets=None,
                 models=None,
                 undersample_before_eval=False):
        #
        # call the BaseLearner constructor to initialize various globals and process the
        # datasets, etc.; of course, these can subsequently be overwritten.
        BaseSVMLearner.__init__(
            self,
            unlabeled_datasets=unlabeled_datasets,
            models=models,
            undersample_before_eval=undersample_before_eval)

        # ovewrite svm parameters here
        self.params = [svm_parameter() for d in unlabeled_datasets]
        # there's no reason to rebuild the models during active learning,
        # since we're just randomly picking things to label
        self.rebuild_models_at_each_iter = False
        print "switching query function to RANDOM"
        #
        # Here we switch the query function to randomly sampling. Note that
        # this function actually lives in the base_learner parent class, because
        # it may very well be useful for other learners to request ids for random
        # unlabeled examples
        #
        self.query_function = self.get_random_unlabeled_ids
        self.name = "Random"
        print "%s learner intialized with %s labeled examples" % (
            self.name, self.labeled_datasets[0].size())
Exemplo n.º 2
0
    def __init__(self, unlabeled_datasets = [], experts=None,
                         models=None, undersample_before_eval = False, request_path=None):
        #
        # call the BaseLearner constructor to initialize various globals and process the
        # datasets, etc.; of course, these can subsequently be overwritten.
        BaseSVMLearner.__init__(self, unlabeled_datasets=unlabeled_datasets, models=models,
                                                undersample_before_eval = undersample_before_eval)


        #
        # most importantly we change the query function to SIMPLE here
        #
        self.query_function = self.DT
    def __init__(self, unlabeled_datasets = None, models=None, undersample_before_eval = False):
        #
        # call the BaseLearner constructor to initialize various globals and process the
        # datasets, etc.; of course, these can subsequently be overwritten.
        BaseSVMLearner.__init__(self, unlabeled_datasets=unlabeled_datasets, models=models,
                                                undersample_before_eval = undersample_before_eval)


        #
        # most importantly we change the query function to max_contention here
        #
        print "switching query function to max contention!"
        self.query_function = self.max_contention
        self.name = "CoTester_max_contention" 
Exemplo n.º 4
0
    def __init__(self, unlabeled_datasets = [], models=None, undersample_before_eval = False, request_path=None):
        #
        # call the BaseLearner constructor to initialize various globals and process the
        # datasets, etc.; of course, these can subsequently be overwritten.
        BaseSVMLearner.__init__(self, unlabeled_datasets=unlabeled_datasets, models=models,
                                                undersample_before_eval = undersample_before_eval)


        #
        # most importantly we change the query function to SIMPLE here
        #
        self.query_function = self.faker
        self.name ="FAKER"
        self.get_these = eval(open(request_path, 'r').readline())
    def __init__(self, learners, unlabeled_datasets=None, undersample_before_eval = False, kernel_type=RBF, 
                    weights=[1,100], use_raw=False, name="STACKED"):
        BaseSVMLearner.__init__(self, unlabeled_datasets=unlabeled_datasets,
                                                undersample_before_eval = undersample_before_eval)

        self.learners = learners
        self.labeled_datasets = None# stacked dataset
        self.unlabeled_datasets = None
        self.kernel_type = kernel_type
        self.weights = weights

        # If use_raw is true, the meta features will be the raw (signed) distances of
        # points from the hyperplanes, rather than the binary 1/-1 predictions.
        self.use_raw = use_raw
        self.name = name
Exemplo n.º 6
0
    def __init__(self, unlabeled_datasets = [], models=None, undersample_before_eval = False, kernel_type=LINEAR, svm_params=None):
        #
        # call the BaseLearner constructor to initialize various globals and process the
        # datasets, etc.; of course, these can subsequently be overwritten.
        BaseSVMLearner.__init__(self, unlabeled_datasets=unlabeled_datasets, models=models,
                                                undersample_before_eval = undersample_before_eval, kernel_type=kernel_type,
                                                svm_params=svm_params)


        #
        # most importantly we change the query function to SIMPLE here
        #
        print "switching query function to SIMPLE!"
        self.query_function = self.SIMPLE
        self.name = "SIMPLE"
Exemplo n.º 7
0
 def __init__(self, unlabeled_datasets = [], models=None):
     #
     # call the BaseLearner constructor to initialize various globals and process the
     # datasets, etc.; of course, these can subsequently be overwritten.
     BaseSVMLearner.__init__(self, unlabeled_datasets=unlabeled_datasets, models=models)
     #super(SimpleLearner, self).__init__()
     # ovewrite svm parameters here 
     self.params = [svm_parameter()  for d in unlabeled_datasets]
     
     print "switching query function to SIMPLE!"
     #
     # most importantly we change the query function to SIMPLE here
     #
     self.query_function = self.SIMPLE
     self.name = "SIMPLE"
Exemplo n.º 8
0
    def __init__(self, unlabeled_datasets = [], models=None):
        #
        # call the BaseLearner constructor to initialize various globals and process the
        # datasets, etc.; of course, these can subsequently be overwritten.
        BaseSVMLearner.__init__(self, unlabeled_datasets=unlabeled_datasets, models=models)

        # ovewrite svm parameters here 
        self.params = [svm_parameter()  for d in unlabeled_datasets]
    
        print "switching query function to RANDOM"
        #
        # Here we switch the query function to randomly sampling. Note that 
        # this function actually lives in the base_learner parent class, because
        # it may very well be useful for other learners to request ids for random
        # unlabeled examples
        #
        self.query_function = self.get_random_unlabeled_ids 
        self.name = "Random"
    def __init__(self,
                 unlabeled_datasets=None,
                 models=None,
                 undersample_before_eval=False):
        #
        # call the BaseLearner constructor to initialize various globals and process the
        # datasets, etc.; of course, these can subsequently be overwritten.
        BaseSVMLearner.__init__(
            self,
            unlabeled_datasets=unlabeled_datasets,
            models=models,
            undersample_before_eval=undersample_before_eval)

        #
        # most importantly we change the query function to max_contention here
        #
        print "switching query function to max contention!"
        self.query_function = self.max_contention
        self.name = "CoTester_max_contention"
Exemplo n.º 10
0
    def __init__(self, unlabeled_datasets = [], models=None, undersample_before_eval=False):
        #
        # call the BaseLearner constructor to initialize various globals and process the
        # datasets, etc.; of course, these can subsequently be overwritten.
        BaseSVMLearner.__init__(self, unlabeled_datasets=unlabeled_datasets, models=models,
                                    undersample_before_eval=undersample_before_eval)

        # ovewrite svm parameters here 
        self.params = [svm_parameter()  for d in unlabeled_datasets]
    
        print "switching query function to RANDOM"
        #
        # Here we switch the query function to randomly sampling. Note that 
        # this function actually lives in the base_learner parent class, because
        # it may very well be useful for other learners to request ids for random
        # unlabeled examples
        #
        self.query_function = self.get_random_unlabeled_ids 
        self.name = "Random"
    def __init__(self, unlabeled_datasets = None, models=None, undersample_before_eval = False):
        #
        # call the BaseLearner constructor to initialize various globals and process the
        # datasets, etc.; of course, these can subsequently be overwritten.
        BaseSVMLearner.__init__(self, unlabeled_datasets=unlabeled_datasets, models=models, 
                                                undersample_before_eval = undersample_before_eval)

        # ovewrite svm parameters here 
        self.params = [svm_parameter()  for d in unlabeled_datasets]
        # there's no reason to rebuild the models during active learning,
        # since we're just randomly picking things to label
        self.rebuild_models_at_each_iter = False 
        print "switching query function to RANDOM"
        #
        # Here we switch the query function to randomly sampling. Note that 
        # this function actually lives in the base_learner parent class, because
        # it may very well be useful for other learners to request ids for random
        # unlabeled examples
        #
        self.query_function = self.get_random_unlabeled_ids 
        self.name = "Random"
        print "%s learner intialized with %s labeled examples" % (self.name, self.labeled_datasets[0].size())
Exemplo n.º 12
0
    def __init__(self,
                 unlabeled_datasets=[],
                 models=None,
                 undersample_before_eval=False):
        #
        # call the BaseLearner constructor to initialize various globals and process the
        # datasets, etc.; of course, these can subsequently be overwritten.
        BaseSVMLearner.__init__(
            self,
            unlabeled_datasets=unlabeled_datasets,
            models=models,
            undersample_before_eval=undersample_before_eval)

        # ovewrite svm parameters here
        self.params = [svm_parameter() for d in unlabeled_datasets]

        print "switching query function to SIMPLE!"
        #
        # most importantly we change the query function to SIMPLE here
        #
        self.query_function = self.SIMPLE
        self.name = "SIMPLE"
Exemplo n.º 13
0
    def __init__(self,
                 learners,
                 unlabeled_datasets=None,
                 undersample_before_eval=False,
                 kernel_type=RBF,
                 weights=[1, 100],
                 use_raw=False,
                 name="STACKED"):
        BaseSVMLearner.__init__(
            self,
            unlabeled_datasets=unlabeled_datasets,
            undersample_before_eval=undersample_before_eval)

        self.learners = learners
        self.labeled_datasets = None  # stacked dataset
        self.unlabeled_datasets = None
        self.kernel_type = kernel_type
        self.weights = weights

        # If use_raw is true, the meta features will be the raw (signed) distances of
        # points from the hyperplanes, rather than the binary 1/-1 predictions.
        self.use_raw = use_raw
        self.name = name