Skip to content

Commit e72226a

Browse files
committed
optimize E
1 parent 650185e commit e72226a

File tree

3 files changed

+319
-39
lines changed

3 files changed

+319
-39
lines changed

.idea/workspace.xml

Lines changed: 70 additions & 39 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

svm/svm_test.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
# @Last modified by: WenDesi
66
# @Last modified time: 12-11-16
77

8+
import time
89
import csv
910
import random
1011

@@ -216,9 +217,12 @@ def split_features_labels(dataset):
216217
# train_features,train_labels = [[3,3],[4,4],[1,1]],[1,1,-1]
217218
# test_features,test_labels = [[0,0],[0,3],[0,6]],[-1,-1,1]
218219

220+
time1 = time.time()
219221
svm = SVM()
220222
svm.train(train_features,train_labels)
221223
test_predict = svm.predict(test_features)
222224

223225
accuracy = sum([test_labels[i]==test_predict[i] for i in xrange(len(test_predict))])
224226
print 'accuracy is ', float(accuracy)/float(len(test_labels))
227+
time2 = time.time()
228+
print 'cost ',time2-time1

0 commit comments

Comments
 (0)