Exemplo n.º 1
0
 def prepare_all_data(self):
     x_train, x_test, y_train, y_test = train_test_split(
         self.dataset.review, self.dataset.sentiment, random_state=0,
         test_size=0.1)
     x_train = doc2VecModel.label_sentences(x_train, 'Train')
     x_test = doc2VecModel.label_sentences(x_test, 'Test')
     all_data = x_train + x_test
     return x_train, x_test, y_train, y_test, all_data
Exemplo n.º 2
0
    def prepare_all_data(self):
        #x_train, x_test, y_train, y_test = train_test_split(
        #    self.dataset.review, self.dataset.sentiment, random_state=0,
        #    test_size=0.1)
        x_train, x_test, y_train, y_test = train_test_split(
            self.dataset.description, self.dataset.organism_code, random_state=0,
            test_size=0.1)
        x_train = doc2VecModel.label_sentences(x_train, 'Train')
        x_test = doc2VecModel.label_sentences(x_test, 'Test')
        #x_train2 = doc2VecModel.label_sentences2(x_train, 'Train')
        all_data = x_train + x_test
        return x_train, x_test, y_train, y_test, all_data

        #x_train, x_test, y_train, y_test = train_test_split(tc.dataset.review, tc.dataset.sentiment, random_state=0,test_size=0.1)
        #x_train, x_test, y_train, y_test = train_test_split(tc.dataset.description, tc.dataset.category_code, random_state=0,test_size=0.1)
        #x_train = doc2VecModel.label_sentences(x_train, 'Train')

        x_train2 = doc2VecModel.label_sentences2(x_train, 'Train')
        x_train2 = label_sentences2(x_train, 'Train')
Exemplo n.º 3
0
 def prepare_test_data(self, sentence):
     x_test = doc2VecModel.label_sentences(sentence, 'Test')
     return x_test