aboutsummaryrefslogtreecommitdiff
path: root/Assignment 6/packages/decision_boundaries.py
blob: 7131ba9a09a9d30fc1d76024e5b72b1b79a0d317 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#for a neural network object nw ...
nw = 

figure(1); hold(True)    
delta = 0.05; levels = 100
a = arange(-1,2,delta)
b = arange(-1,2,delta)
A, B = meshgrid(a, b)
values = np.zeros(A.shape)

for i in range(len(a)):
    for j in range(len(b)):
        values[i,j] = nw.sim( np.mat([a[i],b[j]]) )[0,0]
contour(A, B, values, levels=[.5], colors=['k'], linestyles='dashed')
contourf(A, B, values, levels=linspace(values.min(),values.max(),levels), cmap=cm.RdBu)