示例#1
0
def testAdaptive(dataPackage, time, target_acc, kfold):
    from copy import deepcopy
    from AUREA.adaptive.Adaptive import Adaptive
    #partition the samples
    lq = adaptiveGetLearnerQueue(dataPackage)
    adaptive = Adaptive(lq)
    return adaptive.crossValidate(target_acc,time, kfold)
示例#2
0
    def trainAdaptive(self, target_accuracy, maxTime  ):
        self.queue.put(('statusbarset',"Configuring adaptive training"))
        
        acc = float(target_accuracy)
        mtime = int(maxTime)
        maxTime = mtime

        target_accuracy = acc
        #build learner queue
        self._adaptiveSetup()
        #create adaptive object
        adaptive = Adaptive(self.learnerqueue, app_status_bar = self.queue)
        top_acc, top_settings, top_learner = adaptive.getLearner(target_accuracy, maxTime)
        #store adaptive results (really should be in adaptive)
        self.adaptive_history = adaptive.getHistory()
        self.adaptive_history.reverse()
        self.adaptive = top_learner
        self.adaptive_settings = top_settings
        self.adaptive_top_mcc = top_acc
        self.adaptive_setting_string  = adaptive.getSettingString(top_settings)
        if self.adaptive is not None:
            row_key = top_settings['data_type']
            self.queue.put(('statusbarset',"Training Complete, Checking Accuracy"))
            self.adaptive_acc = self._getLearnerAccuracy(self.adaptive, row_key)
            self.queue.put(('statusbarset',"Accuracy Check Complete"))
        else:
            #none of the algorithms ran, maybe timeout is to low
            self.queue.put(('statusbarset',"Adaptive failed to run. Is the timeout too low?"))
示例#3
0
 def crossValidateAdaptive(self, target_acc, maxtime):
     self._adaptiveSetup()
     #create adaptive object
     adaptive = Adaptive(self.learnerqueue, app_status_bar = self.queue)
     #using accuracy, because we are reporting accuracy - acc is not used to choose learner
     adaptive.crossValidate(target_acc, maxtime)
     self.adaptive_tt = adaptive.truth_table[:]
     self.queue.put(('statusbarset',"Adaptive had an Accuracy of " + str(self._acc(self.adaptive_tt))[:4]))