Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2010

[Date Index] [Thread Index] [Author Index]

Search the Archive

Dynamic evaluation of layered networks

  • To: mathgroup at smc.vnet.net
  • Subject: [mg109317] Dynamic evaluation of layered networks
  • From: "OmniaOpera" <OmniaOpera at _deletethistext_googlemail.com>
  • Date: Wed, 21 Apr 2010 07:47:31 -0400 (EDT)

I want to implement a multilayer feedforward network in such a way that 
changing value(s) in the input layer automatically causes reevaluation of 
only those parts of the network that are involved in the display of a 
result, and it seems to me that Dynamic does what I want.

A simple 3-layer example would be:

f1[x_] = x^2;
f2[x_] := f1[x] + 1;
f3a[x_] := f2[x] + 1;
f3b[x_] := f2[x] - 1;

Dynamic[{f3a[2], f3b[2]}]

Any subsequent change to the f1[x_] = definition in the input layer 
automatically causes the above Dynamic to reevaluate.

That's fine, except that this causes f2[x] to be evaluated twice, once for 
f3a[x] and once for f3b[x], which would be inefficient when generalised to 
very large layered networks in which the f functions are costly to evaluate. 
Unfortunately, the f2[x]:=f2[x]=... trick for memorising previously 
evaluated results doesn't help us here because it prevents the Dynamic from 
being sensitive to changes in the f1[x_] = definition in the input layer.

There are messy ways of programming around this problem (e.g. using the 
memorisation trick but modified so you forget memorised results that are 
"out of date"), but is there any solution that finesses the problem by 
cleverly using Mathematica's evaluation engine?

OO 



  • Prev by Date: Re: Bug in Mathematica 7.0.1.0 ?
  • Next by Date: Re: Using Solve[] - What did I do wrong?
  • Previous by thread: Re: Lining up y axes and sizing plot areas
  • Next by thread: Re: Dynamic evaluation of layered networks