#!/usr/bin/python """ Adam Kavka and Levi Melnick December 2014 This calls functions in utility.py to get the function-words feature set for disputed and undisputed papers and writes the results to disk. """ import pickle import utility import utility as u """m1=u.getUndisputedFederalistMatrix() m2=u.getDisputedFederalistMatrix() u.writeMatrixToFile(m1, "code/svm_light/fedTrain.txt") u.writeMatrixToFile(m2, "code/svm_light/fedTest.txt") """ m1 = u.getTrainingMatrix() m2 = u.getUndisputedFederalistMatrix() u.writeMatrixToFile(m1, "code/svm_light/fedTrain.txt") u.writeMatrixToFile(m2, "code/svm_light/fedTest.txt")
#!/usr/bin/python """ Adam Kavka and Levi Melnick December 2014 This calls functions in utility.py to get the function-words feature set for disputed and undisputed papers and writes the results to disk. """ import pickle import utility import utility as u """m1=u.getUndisputedFederalistMatrix() m2=u.getDisputedFederalistMatrix() u.writeMatrixToFile(m1, "code/svm_light/fedTrain.txt") u.writeMatrixToFile(m2, "code/svm_light/fedTest.txt") """ m1=u.getTrainingMatrix() m2=u.getUndisputedFederalistMatrix() u.writeMatrixToFile(m1, "code/svm_light/fedTrain.txt") u.writeMatrixToFile(m2, "code/svm_light/fedTest.txt")
""" Adam Kavka and Levi Melnick December 2014 This runs the SVM program (a third party C program) on the features sets that script.py and testGensim.py wrote to disk. """ import utility as u import os from permute import permute m=u.getUndisputedFederalistMatrix() d=u.getDisputedFederalistMatrix() trainfile = "code/svm_light/fedTrain.txt" testfile = "code/svm_light/fedTest.txt" modelfile = "code/svm_light/fedModel.txt" predictionfile = "code/svm_light/fedPredictions" u.writeMatrixToFile(m, trainfile) u.writeMatrixToFile(d, testfile) os.system("./code/svm_light/svm_learn -x 1 -c 1000000.0 " + trainfile + " " + modelfile) os.system("./code/svm_light/svm_classify " + testfile + " " + modelfile + " " + predictionfile)