Ejemplo n.º 1
0
    def predict_t2(self, grid_search = True):
        if self.docs == {}:
            raise ValueError("docs have not been created. call set_prediction_docs first!")

        # get features and target
        X, Y, info = self.get_feature('t2')
        
        # init svm classifier
        svm = SVM(self._model_path, "trig-theme1-2", "linear", grid_search = grid_search, class_weight = 'auto')
        svm.load()
        
        return svm.predict(X), Y, info
Ejemplo n.º 2
0
 def predict_tt(self, grid_search = True):
     """
     return prediction of given docid_list
     """
     if self.docs == {}:
         raise ValueError("docs have not been created. call set_prediction_docs first!")
     # get list of file
     #doc_ids = self.get_docid_list(docid_list_fname)
     
     # get features and target
     X, Y, info = self.get_feature('tt')
     
     # init svm classifier
     svm = SVM(self._model_path, "trig-trig", "linear", grid_search = grid_search, class_weight = 'auto')
     svm.load()
     
     return svm.predict(X), Y, info