From 5ae9358487b6266d2a221ebc2bcf72d735e09b25 Mon Sep 17 00:00:00 2001 From: Thibaut Horel Date: Thu, 23 Feb 2012 17:23:33 -0800 Subject: Cleaning of svm code. Analysis of the performances --- data/svm/accuracy.py | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100755 data/svm/accuracy.py (limited to 'data/svm/accuracy.py') diff --git a/data/svm/accuracy.py b/data/svm/accuracy.py new file mode 100755 index 0000000..4d9ea6b --- /dev/null +++ b/data/svm/accuracy.py @@ -0,0 +1,33 @@ +#! /usr/bin/python +import sys +import numpy as np +import matplotlib.pyplot as plt + +log_filename = sys.argv[1] +nums,accuracy = np.loadtxt(log_filename,comments=";",delimiter='#',unpack=True,usecols=(0,2)) +nums_unique = np.unique(nums) +means = [] +mins = [] +maxs = [] +for i in nums_unique: + filtered = accuracy[nums==i] + mean = np.mean(filtered) + min_value = min(filtered) + max_value = max(filtered) + var = np.var(filtered) + means += [mean] + mins += [mean-min_value] + maxs += [max_value-mean] + print ",".join(map(str,[int(i),mean,min_value,max_value,var])) + +x = map(int,list(nums_unique)) +axes = plt.subplot(111) +axes.set_xlabel("Group size") +axes.set_ylabel("Accuracy") +a = axes.set_xlim((0,22)) +axes.set_ylim((0,100)) +axes.set_xticks(x) +plt.errorbar(x,means,yerr=[mins,maxs],linestyle="-",marker="o",ecolor="gray") +plt.savefig("test.png") + + -- cgit v1.2.3-70-g09d2