MathGroup Archive 2010

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

Search the Archive

Re: Dynamic evaluation of layered networks

  • To: mathgroup at
  • Subject: [mg109332] Re: Dynamic evaluation of layered networks
  • From: "David Park" <djmpark at>
  • Date: Thu, 22 Apr 2010 03:30:54 -0400 (EDT)

This leaves me confused. Do you mean that you are making a dynamic
presentation and when you change the single input variable x you want to
efficiently recalculate all the other values? Or are you also changing the f

In the first case you could write a routine calcAll[x_] to efficiently
calculate all the values when x is changed. Then use the second argument in
Dynamic to calculate everything when x is changed. Dynamic[x,

David Park
djmpark at  

From: OmniaOpera [mailto:OmniaOpera at] 

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?


  • Prev by Date: Re: Lining up y axes and sizing plot areas
  • Next by Date: Re: Button Problem
  • Previous by thread: Dynamic evaluation of layered networks
  • Next by thread: Re: Dynamic evaluation of layered networks