Skip to content

Commit

Permalink
Merge pull request #10 from asherp7/asher_svm
Browse files Browse the repository at this point in the history
modify train_svm.py
  • Loading branch information
asherp7 authored Jan 21, 2019
2 parents 11327b9 + 67b67f9 commit c5be5d7
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions hack_proj/train_svm.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
TESTING_RATIO = 0.1


def svm_testing_loss(clf, test_data, test_labels):
def svm_testing_loss(clf, test_data, test_labels, k):
predictions = clf.predict(test_data)
fn, fp, tn, tp = 0, 0, 0, 0
for predction, label in zip(predictions, test_labels):
Expand All @@ -31,6 +31,7 @@ def svm_testing_loss(clf, test_data, test_labels):
print('* *')
print('* SVM RESULTS: *')
print('* *')
print('* K-mer length = ', k)
print('* RECALL = ', recall)
print('* PRECISION = ', precision)
print('* TP = ', tp)
Expand Down Expand Up @@ -79,7 +80,7 @@ def train_svm(data_path, k):
clf = svm.SVC(gamma='scale')
# print(' Started SVM Training...')
clf.fit(X[:-size_of_test_set], Y[:-size_of_test_set])
results = svm_testing_loss(clf, X[-size_of_test_set:], Y[-size_of_test_set:])
results = svm_testing_loss(clf, X[-size_of_test_set:], Y[-size_of_test_set:], k)
return results


Expand Down

0 comments on commit c5be5d7

Please sign in to comment.