<commit_before>from sklearn import svm
x= [[0,0],[1,2]]
y = [0,1]
clf = svm.SVC()
clf.fit(x,y)
clf.predict([[2,2]])<commit_msg>add SVM<commit_after>from sklearn import svm
import numpy as nu
class SVM:
	x=[]
	y=[]
	clf = None
	def __init__(self,filename):
		with open(filename) as f:
			for line in f:
				if(line[0]>='0' and line[0]<='9'):
					#print(line)
					tmp = line.strip('\n').split(',')
					tmp = map(lambda x:float(x),tmp)
					self.x.append(tmp[:-1])
					self.y.append(tmp[-1])
		self.clf = svm.SVC()
	def train(self):
		self.clf.fit(self.x,self.y)
	def predict(self,input):
		return self.clf.predict(input)
if __name__ == "__main__":
	svm = SVM("../decisionTree/trainingSet/train_500.txt")
	svm.train()
	print(svm.x[0])
	print(svm.predict(svm.x[0]))
{'fraction_non_alphanumeric': 0.20915032679738563, 'fraction_numerical': 0.02483660130718954, 'mean_word_length': 4.0394736842105265, 'pattern_counts': {'":': 1, '<': 4, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3976910', 'n_tokens_mistral': 372, 'n_tokens_neox': 337, 'n_words': 64}