def setUp(self):
     sys.path.append( path.dirname( path.dirname( path.abspath(__file__) ) ) )
     fileName, pathname, description = imp.find_module('infodens')
     
     from infodens.preprocessor import preprocess
     self.prepObj = preprocess.Preprocess('testFile.txt')
     from infodens.formater import format
     
     from infodens.controller import controller
     self.conObj = controller.Controller('testconfig.txt')
     ch, ids, cl = self.conObj.loadConfig()
     
     from infodens.featurextractor import featureManager
     self.featMgrObj = featureManager.FeatureManager(4,self.conObj.featureIDs, self.conObj.featargs, self.prepObj,1)
     
     self.conObj2 = controller.Controller('testconfig2.txt')
     self.conObj2.loadConfig()
     self.prepObj2 = preprocess.Preprocess('testFile.txt')
     self.featMgrObj2 = featureManager.FeatureManager(4,self.conObj2.featureIDs, self.conObj2.featargs, self.prepObj2, 1)
     
     self.features = self.featMgrObj2.callExtractors()
     self.prepObj3 = preprocess.Preprocess('labelFile.txt')
     self.labels = self.prepObj3.preprocessClassID()
     
     self.X = self.features
     self.y = np.asarray(self.labels)
     self.fmtObj = format.Format(self.X, self.y)
     
     from infodens.classifier import classifierManager
     self.clfMgrObj = classifierManager.ClassifierManager(self.conObj2.classifiersList,self.X, self.y)
Пример #2
0
 def setUp(self):
     sys.path.append(path.dirname(path.dirname(path.abspath(__file__))))
     fileName, pathname, description = imp.find_module('infodens')
     from infodens.preprocessor import preprocess
     self.prepObj = preprocess.Preprocess('testFile.txt')
     from infodens.controller import controller
     self.conObj = controller.Controller('testconfig.txt')
     self.conObj2 = controller.Controller('testconfig2.txt')
Пример #3
0
    def test_parseOutputLine2(self):
        from infodens.preprocessor import preprocess
        prepObj = preprocess.Preprocess('testFile.txt')
        from infodens.controller import controller

        conObj = controller.Controller('testconfig.txt')
        c = 1
        ch = conObj.parseOutputLine('output features: feats.txt format')
        self.assertEquals(c, ch)
Пример #4
0
    def test_parseOutputLine(self):
        from infodens.preprocessor import preprocess
        prepObj = preprocess.Preprocess('testFile.txt')
        from infodens.controller import controller

        conObj = controller.Controller('testconfig.txt')
        c = 1
        ch = conObj.parseOutputLine('output classifier: report1.txt')
        self.assertEquals(c, ch)
    def setUp(self):
        sys.path.append(path.dirname(path.dirname(path.abspath(__file__))))
        fileName, pathname, description = imp.find_module('infodens')
        from infodens.preprocessor import preprocess
        self.prepObj = preprocess.Preprocess('testFile.txt')

        from infodens.controller import controller
        self.conObj = controller.Controller('testconfig.txt')
        ch, ids, cids = self.conObj.loadConfig()

        from infodens.featurextractor import featureManager
        self.featMgrObj = featureManager.FeatureManager(
            4, self.conObj.featureIDs, self.conObj.featargs, self.prepObj, 1)

        self.conObj2 = controller.Controller('testconfig2.txt')
        self.conObj2.loadConfig()
        self.prepObj2 = preprocess.Preprocess('testFile.txt')
        self.featMgrObj2 = featureManager.FeatureManager(
            4, self.conObj2.featureIDs, self.conObj2.featargs, self.prepObj2,
            1)
Пример #6
0
    def test_manageFeatures(self):

        from infodens.preprocessor import preprocess
        prepObj = preprocess.Preprocess('testFile.txt')
        from infodens.controller import controller

        conObj = controller.Controller('testconfig2.txt')
        ch, ids, cids = conObj.loadConfig()
        c = 1
        ch = conObj.manageFeatures()
        self.assertEquals(c, ch)
Пример #7
0
    def test_classesSentsMismatch(self):

        from infodens.preprocessor import preprocess
        prepObj = preprocess.Preprocess('testFile.txt')
        from infodens.controller import controller

        conObj = controller.Controller('testconfig.txt')
        prepObj = preprocess.Preprocess('testFile.txt')
        c = False
        ch = conObj.classesSentsMismatch(prepObj)
        self.assertEquals(c, ch)
Пример #8
0
    def test_loadConfig(self):

        from infodens.preprocessor import preprocess
        prepObj = preprocess.Preprocess('testFile.txt')
        from infodens.controller import controller

        conObj = controller.Controller('testconfig.txt')
        c = 1
        ch, ids, cids = conObj.loadConfig()
        self.assertEquals(c, ch)

        fids = conObj.featureIDs
        chfids = [1, 2, 4, 4, 5, 6, 7, 10, 11]
        self.assertListEqual(fids, chfids)

        clfList = conObj.classifiersList
        chclfList = ['DecisionTree', 'RandomForest', 'SVM']
        self.assertListEqual(clfList, chclfList)

        featArgs = [[], [], '1,10', '2,5', '1,10', '1,10', '1,10', [], []]
        chfeatArgs = conObj.featargs
        self.assertListEqual(featArgs, chfeatArgs)