-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtest.py
More file actions
44 lines (34 loc) · 1.47 KB
/
test.py
File metadata and controls
44 lines (34 loc) · 1.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# -*- coding: utf-8 -*-
"""
@author: Niraj Gautam
"""
import model
import ensemble
from helper import feature_extraction
def test(featureExtraction,classifier,doc):
feats = featureExtraction.find_feature(doc)
return classifier.classify(feats), classifier.confidence(feats)
if __name__== "__main__":
featureExtraction= feature_extraction.Featurextraction()
m=model.Model()
ONB_Clf = m.load_model('./models/ONB_clf.pickle')
MNB_Clf = m.load_model('./models/MNB_clf.pickle')
BNB_Clf = m.load_model('./models/BNB_clf.pickle')
LogReg_Clf = m.load_model('./models/LogReg_clf.pickle')
SGD_Clf = m.load_model('./models/SGD_clf.pickle')
SVC_clf = m.load_model('./models/SVC_clf.pickle')
ensemble_clf = ensemble.EnsembleClassifier(ONB_Clf, MNB_Clf, BNB_Clf, LogReg_Clf, SGD_Clf,SVC_clf)
doc=[
"Her beauty is laced in her strength and interwoven through her flaws. She embodies perfection.",
" what is python?",
"I found it to be because of only 1's or 0's wound up in my y_test since my sample size was really small. ",
"Positive anything is better than negative nothing.",
"Be positive. Be true. Be kind.",
"Write it on your heart that every day is the best day in the year."
]
result=[]
for i in doc:
output=test(featureExtraction,ensemble_clf,i)
d=[i,output]
result.append(d)
print(result)