Example #1
0
 def testPredict(self):
     generator = SVMLeafRank(self.paramDict, self.folds)
     learner = generator.generateLearner(self.X, self.y)
     
     predY = learner.predict(self.X)
     #Seems to work
     auc = learner.getMetricMethod()(predY, self.y)
     auc2 = Evaluator.auc(predY, self.y)    
     
     self.assertEquals(auc, auc2)
Example #2
0
    def testSetWeight(self):
        #Try weight = 0 and weight = 1
        generator = SVMLeafRank(self.paramDict, self.folds)
        generator.setWeight(0.0)
        learner = generator.generateLearner(self.X, self.y)

        predY = learner.predict(self.X)
        self.assertTrue((predY == -1*numpy.ones(predY.shape[0])).all())
        
        learner = SVMLeafRank(self.paramDict, self.folds)
        learner.setWeight(1.0)
        learner = learner.generateLearner(self.X, self.y)
        predY = learner.predict(self.X)
        self.assertTrue((predY == numpy.ones(predY.shape[0])).all())