2
<!doctype html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
3
<html><head><title>Python: module rbf</title>
4
</head><body bgcolor="#f0f0f8">
6
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="heading">
8
<td valign=bottom> <br>
9
<font color="#ffffff" face="helvetica, arial"> <br><big><big><strong>rbf</strong></big></big></font></td
10
><td align=right valign=bottom
11
><font color="#ffffff" face="helvetica, arial"><a href=".">index</a><br><a href="file:/home/tilde/programming/SoC/scipy/Lib/sandbox/ann/rbf.py">/home/tilde/programming/SoC/scipy/Lib/sandbox/ann/rbf.py</a></font></td></tr></table>
12
<p><tt># rbf2.py<br>
14
# 2006/08/20</tt></p>
16
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
17
<tr bgcolor="#aa55cc">
18
<td colspan=3 valign=bottom> <br>
19
<font color="#fffff" face="helvetica, arial"><big><strong>Modules</strong></big></font></td></tr>
21
<tr><td bgcolor="#aa55cc"><tt> </tt></td><td> </td>
22
<td width="100%"><table width="100%" summary="list"><tr><td width="25%" valign=top><a href="numpy.html">numpy</a><br>
23
</td><td width="25%" valign=top><a href="random.html">random</a><br>
24
</td><td width="25%" valign=top></td><td width="25%" valign=top></td></tr></table></td></tr></table><p>
25
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
26
<tr bgcolor="#ee77aa">
27
<td colspan=3 valign=bottom> <br>
28
<font color="#ffffff" face="helvetica, arial"><big><strong>Classes</strong></big></font></td></tr>
30
<tr><td bgcolor="#ee77aa"><tt> </tt></td><td> </td>
32
<dt><font face="helvetica, arial"><a href="rbf.html#rbf">rbf</a>
35
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
36
<tr bgcolor="#ffc8d8">
37
<td colspan=3 valign=bottom> <br>
38
<font color="#000000" face="helvetica, arial"><a name="rbf">class <strong>rbf</strong></a></font></td></tr>
40
<tr bgcolor="#ffc8d8"><td rowspan=2><tt> </tt></td>
41
<td colspan=2><tt>Class to define/train/test a radial basis function network<br> </tt></td></tr>
43
<td width="100%">Methods defined here:<br>
44
<dl><dt><a name="rbf-__init__"><strong>__init__</strong></a>(self, ni, no, f<font color="#909090">='linear'</font>)</dt><dd><tt>Set up instance of RBF net. N.B. RBF centers and variance are selected at training time <br>
46
ni - <int> # of inputs<br>
47
no - <int> # of outputs<br>
48
f - <str> output activation fxn</tt></dd></dl>
50
<dl><dt><a name="rbf-err_fxn"><strong>err_fxn</strong></a>(self, w, X, Y)</dt><dd><tt>Return vector of squared-errors for the leastsq optimizer</tt></dd></dl>
52
<dl><dt><a name="rbf-fwd_all"><strong>fwd_all</strong></a>(self, X, w<font color="#909090">=None</font>)</dt><dd><tt>Propagate values forward through the net.<br>
54
inputs - vector of input values<br>
55
w - packed array of weights<br>
57
array of outputs for all input patterns</tt></dd></dl>
59
<dl><dt><a name="rbf-pack"><strong>pack</strong></a>(self)</dt><dd><tt>Compile weight matrices w,b from net into a<br>
60
single vector, suitable for optimization routines.</tt></dd></dl>
62
<dl><dt><a name="rbf-test_all"><strong>test_all</strong></a>(self, X, Y)</dt><dd><tt>Test network on an array (size>1) of patterns<br>
64
x - array of input data<br>
65
t - array of targets<br>
67
sum-squared-error over all data</tt></dd></dl>
69
<dl><dt><a name="rbf-train"><strong>train</strong></a>(self, X, Y)</dt><dd><tt>Train RBF network:<br>
70
(i) select fixed centers randomly from input data (10%)<br>
71
(ii) set fixed variance from max dist between centers<br>
72
(iii) learn output weights using scipy's leastsq optimizer</tt></dd></dl>
74
<dl><dt><a name="rbf-unpack"><strong>unpack</strong></a>(self)</dt><dd><tt>Decompose 1-d vector of weights w into appropriate weight<br>
75
matrices (self.{w/b}) and reinsert them into net</tt></dd></dl>
77
</td></tr></table></td></tr></table><p>
78
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
79
<tr bgcolor="#eeaa77">
80
<td colspan=3 valign=bottom> <br>
81
<font color="#ffffff" face="helvetica, arial"><big><strong>Functions</strong></big></font></td></tr>
83
<tr><td bgcolor="#eeaa77"><tt> </tt></td><td> </td>
84
<td width="100%"><dl><dt><a name="-main"><strong>main</strong></a>()</dt><dd><tt>Build/train/test RBF net</tt></dd></dl>
b'\\ No newline at end of file'