def validateModel(self, testFile):
     testdata = LibsvmFileImporter(testFile).get_dataSet()
     self.__inst_test = testdata.get_numInstances()
     ## --- statistics
     correct = 0.
     sum_error = 0
     for i in testdata.get_targets():
         if i == 1:  #correct
             correct += 1.
         else:
             sum_error += math.pow(1 - i, 2)
     # percent correct
     self.__pct_correct = 100 * (correct / self.__inst_test)
     # root mean squared error
     self.__rmse = math.sqrt(sum_error / self.__inst_test)
Example #2
0
 def validateModel(self, testFile):
     testdata = LibsvmFileImporter(testFile).get_dataSet()
     self.__inst_test = testdata.get_numInstances()
     ## --- statistics
     correct = 0.
     sum_error = 0
     for i in testdata.get_targets():
         if i == 1: #correct
             correct += 1.
         else:
             sum_error += math.pow(1 - i, 2)
     # percent correct
     self.__pct_correct = 100 * (correct/self.__inst_test)
     # root mean squared error
     self.__rmse = math.sqrt(sum_error / self.__inst_test)
 def buildClassifier(self, trainFile):
     '''"builds" a classification model returning always 1 for each instance'''
     train = LibsvmFileImporter(trainFile).get_dataSet()
     self.__inst_train = train.get_numInstances()
Example #4
0
 def buildClassifier(self, trainFile):
     '''"builds" a classification model returning always 1 for each instance'''
     train = LibsvmFileImporter(trainFile).get_dataSet()
     self.__inst_train = train.get_numInstances()