예제 #1
0
    def __init__(self, sModelName, sModelDir, sComment=None,dLearnerConfigArg=None):
        if self.bHTR:
            cFeatureDefinition = FeatureDefinition_PageXml_StandardOnes
            dFeatureConfig = { 'bMultiPage':False, 'bMirrorPage':False
                          , 'n_tfidf_node':500, 't_ngrams_node':(2,4), 'b_tfidf_node_lc':False
                          , 'n_tfidf_edge':250, 't_ngrams_edge':(2,4), 'b_tfidf_edge_lc':False }
        else:
            cFeatureDefinition = FeatureDefinition_PageXml_StandardOnes_noText
            dFeatureConfig = { 'bMultiPage':False, 'bMirrorPage':False
                          , 'n_tfidf_node':None, 't_ngrams_node':None, 'b_tfidf_node_lc':None
                          , 'n_tfidf_edge':None, 't_ngrams_edge':None, 'b_tfidf_edge_lc':None }


        if sComment is None: sComment  = sModelName


        DU_ECN_Task.__init__(self
                             , sModelName, sModelDir
                             , dFeatureConfig=dFeatureConfig
                             , dLearnerConfig= dLearnerConfigArg if dLearnerConfigArg is not None else self.dLearnerConfig
                             , sComment=sComment
                             , cFeatureDefinition=cFeatureDefinition
                             , cModelClass=DU_Model_GAT
                             )

        if options.bBaseline:
            self.bsln_mdl = self.addBaseline_LogisticRegression()  # use a LR model trained by GridSearch as baseline
        def __init__(self,
                     sModelName,
                     sModelDir,
                     sComment=None,
                     dLearnerConfigArg=None):
            if sComment is None: sComment = sModelName

            if dLearnerConfigArg is not None and "ecn_ensemble" in dLearnerConfigArg:
                print('ECN_ENSEMBLE')
                DU_ECN_Task.__init__(
                    self,
                    sModelName,
                    sModelDir,
                    dFeatureConfig={},
                    dLearnerConfig=dLearnerConfigArg
                    if dLearnerConfigArg is not None else self.dLearnerConfig,
                    sComment=sComment,
                    cFeatureDefinition=FeatureDefinition_PageXml_NoNodeFeat_v3,
                    cModelClass=gcn.DU_Model_ECN.DU_Ensemble_ECN)

            else:
                #Default Case Single Model
                DU_ECN_Task.__init__(
                    self,
                    sModelName,
                    sModelDir,
                    dFeatureConfig={},
                    dLearnerConfig=dLearnerConfigArg
                    if dLearnerConfigArg is not None else self.dLearnerConfig,
                    sComment=sComment,
                    cFeatureDefinition=FeatureDefinition_PageXml_NoNodeFeat_v3)
예제 #3
0
    def __init__(self,
                 sModelName,
                 sModelDir,
                 sComment=None,
                 dLearnerConfigArg=None):
        traceln(self.bHTR)

        if self.bHTR:
            cFeatureDefinition = FeatureDefinition_PageXml_StandardOnes
            dFeatureConfig = {
                'bMultiPage': False,
                'bMirrorPage': False,
                'n_tfidf_node': 300,
                't_ngrams_node': (2, 4),
                'b_tfidf_node_lc': False,
                'n_tfidf_edge': 300,
                't_ngrams_edge': (2, 4),
                'b_tfidf_edge_lc': False
            }
        else:
            cFeatureDefinition = FeatureDefinition_PageXml_StandardOnes_noText
            # cFeatureDefinition = FeatureDefinition_PageXml_NoNodeFeat_v3
            dFeatureConfig = {}

        if sComment is None: sComment = sModelName

        if dLearnerConfigArg is not None and "ecn_ensemble" in dLearnerConfigArg:
            traceln('ECN_ENSEMBLE')
            DU_ECN_Task.__init__(
                self,
                sModelName,
                sModelDir,
                dFeatureConfig=dFeatureConfig,
                dLearnerConfig=self.dLearnerConfig
                if dLearnerConfigArg is None else dLearnerConfigArg,
                sComment=sComment,
                cFeatureDefinition=cFeatureDefinition,
                cModelClass=gcn.DU_Model_ECN.DU_Ensemble_ECN)
        else:
            #Default Case Single Model
            DU_ECN_Task.__init__(
                self,
                sModelName,
                sModelDir,
                dFeatureConfig=dFeatureConfig,
                dLearnerConfig=self.dLearnerConfig
                if dLearnerConfigArg is None else dLearnerConfigArg,
                sComment=sComment,
                cFeatureDefinition=cFeatureDefinition)
예제 #4
0
        def __init__(self,
                     sModelName,
                     sModelDir,
                     sComment=None,
                     dLearnerConfigArg=None):

            DU_ECN_Task.__init__(
                self,
                sModelName,
                sModelDir,
                dFeatureConfig={},
                dLearnerConfig=dLearnerConfigArg
                if dLearnerConfigArg is not None else self.dLearnerConfig,
                sComment=sComment,
                cFeatureDefinition=FeatureDefinition_PageXml_NoNodeFeat_v3)

            if options.bBaseline:
                self.bsln_mdl = self.addBaseline_LogisticRegression(
                )  # use a LR model trained by GridSearch as baseline
예제 #5
0
        def __init__(self,
                     sModelName,
                     sModelDir,
                     sComment=None,
                     dLearnerConfigArg=None):
            if sComment is None: sComment = sModelName
            DU_ECN_Task.__init__(
                self,
                sModelName,
                sModelDir,
                dFeatureConfig={},
                dLearnerConfig=dLearnerConfigArg
                if dLearnerConfigArg is not None else self.dLearnerConfig,
                sComment=sComment,
                cFeatureDefinition=
                FeatureDefinition_PageXml_StandardOnes_noText,
                cModelClass=DU_Model_GAT)

            if options.bBaseline:
                self.bsln_mdl = self.addBaseline_LogisticRegression(
                )  # use a LR model trained by GridSearch as baseline
예제 #6
0
 def predict(self, lsColDir):
     """
         Return the list of produced files
         """
     self.sXmlFilenamePattern = "*.mpxml"
     return DU_ECN_Task.predict(self, lsColDir)