In [2]:
image_data = {0.1: [0.31333333333333335, 0.28, 0.36, 0.3433333333333333, 0.38666666666666666], 1.0: [0.5433333333333333, 0.56, 0.5433333333333333, 0.6066666666666667, 0.61], 100.0: [0.5966666666666667, 0.5833333333333334, 0.5733333333333334, 0.58, 0.6266666666666667], 1000.0: [0.04666666666666667, 0.07, 0.03666666666666667, 0.07, 0.08666666666666667], 10.0: [0.62, 0.6233333333333333, 0.62, 0.64, 0.6266666666666667], 0.01: [0.1, 0.12333333333333334, 0.09333333333333334, 0.11666666666666667, 0.15333333333333332], 0.001: [0.04, 0.04, 0.023333333333333334, 0.08, 0.08666666666666667]}

print(image_data)


{0.1: [0.31333333333333335, 0.28, 0.36, 0.3433333333333333, 0.38666666666666666], 1.0: [0.5433333333333333, 0.56, 0.5433333333333333, 0.6066666666666667, 0.61], 100.0: [0.5966666666666667, 0.5833333333333334, 0.5733333333333334, 0.58, 0.6266666666666667], 1000.0: [0.04666666666666667, 0.07, 0.03666666666666667, 0.07, 0.08666666666666667], 10.0: [0.62, 0.6233333333333333, 0.62, 0.64, 0.6266666666666667], 0.01: [0.1, 0.12333333333333334, 0.09333333333333334, 0.11666666666666667, 0.15333333333333332], 0.001: [0.04, 0.04, 0.023333333333333334, 0.08, 0.08666666666666667]}

In [4]:
"""
from bokeh.plotting import figure, output_notebook, show

output_notebook()
p = figure(title="simple line example", x_axis_label='accuracy', y_axis_label='C')

Cs = list(data.keys())
for C, values in data.items():
    print("hola", Cs, values)
    p.circle(Cs, values, legend="Temp.", line_width=2)

# show the results
show(p)
"""
%matplotlib inline
import numpy as np
import matplotlib.pyplot as plt

Cs = []
c_matrix = []
for C, values in image_data.items():
    print(C, values)
    Cs.append(C)
    c_matrix.append(values)

c_matrix = np.array(c_matrix)

for i, c in enumerate(Cs):
    #print(i, c, c_matrix[:, i])
    plt.plot(Cs, c_matrix[:, i], 'ro')
    plt.xscale('log')
    plt.axis([0.01, 100, 0, 1])
plt.show()


0.1 [0.31333333333333335, 0.28, 0.36, 0.3433333333333333, 0.38666666666666666]
1.0 [0.5433333333333333, 0.56, 0.5433333333333333, 0.6066666666666667, 0.61]
100.0 [0.5966666666666667, 0.5833333333333334, 0.5733333333333334, 0.58, 0.6266666666666667]
1000.0 [0.04666666666666667, 0.07, 0.03666666666666667, 0.07, 0.08666666666666667]
10.0 [0.62, 0.6233333333333333, 0.62, 0.64, 0.6266666666666667]
0.01 [0.1, 0.12333333333333334, 0.09333333333333334, 0.11666666666666667, 0.15333333333333332]
0.001 [0.04, 0.04, 0.023333333333333334, 0.08, 0.08666666666666667]
---------------------------------------------------------------------------
IndexError                                Traceback (most recent call last)
<ipython-input-4-88b26471db06> in <module>()
     28 for i, c in enumerate(Cs):
     29     #print(i, c, c_matrix[:, i])
---> 30     plt.plot(Cs, c_matrix[:, i], 'ro')
     31     plt.xscale('log')
     32     plt.axis([0.01, 100, 0, 1])

IndexError: index 5 is out of bounds for axis 1 with size 5

In [5]:
from utils import calculate_accuracy

# load dataset
dataset = load_scene_categories('scene_categories')

ACC = []
for loop in range(5):
    train_set, test_set = n_per_class_split(dataset, n=100)

    # setup training data
    X_train, y_train = split_into_X_y(train_set)
    X_test, y_test = split_into_X_y(test_set)
    ACC.append(calculate_accuracy(X_train, X_test, y_train, y_test, C=10))
print(ACC)


[0.6452261306532663, 0.6485762144053602, 0.6505862646566164, 0.6572864321608041, 0.6402010050251257]

In [7]:
acc_np = np.array(ACC)
print("Mean:", acc_np.mean())
print("Std:", acc_np.std())


Mean: 0.64837520938
Std: 0.00567579727559

In [ ]: