Пример #1
0
    def compareRoc(self, selectedResults=None, append=''):

        if selectedResults:
            results = {
                k: self.models[k].testPrediction()
                for k in selectedResults if k in self.models
            }
        else:
            results = {
                k: self.models[k].testPrediction()
                for k in self.models.keys()
            }

        #As the splitting is done with the same pseudorandom initialisation the test set is always the same
        results['truth'] = self.models.values()[0].data.y_test

        rocCurve(results, output=self.output, append=append)
        pass
Пример #2
0
    def rocCurve(self,doEvalSet=False):

        if self.doRegression:
            print 'Cannot make ROC curve for a regression problem, skipping'
            return None

        if doEvalSet:
            rocCurve(self.model.predict(self.data.X_eval.as_matrix()), self.data.y_eval,self.output,append='_eval')
            rocCurve(self.model.predict(self.data.X_train.as_matrix()),self.data.y_train,self.output,append='_dev')
        else:
            rocCurve(self.model.predict(self.data.X_test.as_matrix()), self.data.y_test,self.output)
            rocCurve(self.model.predict(self.data.X_train.as_matrix()),self.data.y_train,self.output,append='_train')
Пример #3
0
    def rocCurve(self, doEvalSet=False):

        if doEvalSet:  #produce report for dev and eval sets instead
            rocCurve(self.bdt.decision_function(self.data.X_eval),
                     self.data.y_eval,
                     output=self.output,
                     append='_eval')
            rocCurve(self.bdt.decision_function(self.data.X_dev),
                     self.data.y_dev,
                     output=self.output,
                     append='_dev')
        else:
            rocCurve(self.bdt.decision_function(self.data.X_test),
                     self.data.y_test,
                     output=self.output)
            rocCurve(self.bdt.decision_function(self.data.X_train),
                     self.data.y_train,
                     output=self.output,
                     append='_train')