Beispiel #1
0
    def test_trainSeniorModel(self):
        classStatus = 'Senior'
        fileClassStatus = re.sub(' ', '', classStatus)
        modelSaveFile = 'LogisticRegressionTrainedClassifiers\%sClassStatusTrainedLRModel' % fileClassStatus
        featuresValueCountsSaveFile = 'LogisticRegressionTrainedClassifiers\%sClassStatusTrainedFeaturesValueCounts' % fileClassStatus

        # first check to see if can open files:
        testOpenModelSaveFile = open(modelSaveFile, 'rb')
        testOpenModelSaveFile.close()
        testOpenFVCSaveFile = open(featuresValueCountsSaveFile, 'rb')
        testOpenFVCSaveFile.close()

        # do training and save to files
        print("Training '%s' model..." % classStatus)
        testClassify = LogisticRegressionClassifyClassStatusFromPreviouslyUntrainedModel(classStatus=classStatus,
                                                                                         trainingPercentage=0.99,
                                                     modelSaveFile=modelSaveFile,
                                                     featuresValuesCountsSaveFile=featuresValueCountsSaveFile)
        testClassify.trainAndSaveModel()
        print("Training for '%s' complete." % classStatus)
 def test_classifyJuniorGetResults(self):
     testClassify = LogisticRegressionClassifyClassStatusFromPreviouslyUntrainedModel(
         classStatus='Junior', trainingPercentage=0.8)
     testClassify.trainTestAndGetResults()
 def test_classifyMastersLevelGraduateGetResults(self):
     testClassify = LogisticRegressionClassifyClassStatusFromPreviouslyUntrainedModel(
         classStatus='Masters Level Graduate', trainingPercentage=0.8)
     testClassify.trainTestAndGetResults()
 def test_classifyJuniorGetResults(self):
     testClassify = LogisticRegressionClassifyClassStatusFromPreviouslyUntrainedModel(classStatus='Junior',
                                                                                      trainingPercentage=0.8)
     testClassify.trainTestAndGetResults()
 def test_classifyMastersLevelGraduateGetResults(self):
     testClassify = LogisticRegressionClassifyClassStatusFromPreviouslyUntrainedModel(
         classStatus='Masters Level Graduate', trainingPercentage=0.8)
     testClassify.trainTestAndGetResults()