Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2010

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

Search the Archive

Re: Dynamic evaluation of layered networks

  • To: mathgroup at smc.vnet.net
  • Subject: [mg109347] Re: Dynamic evaluation of layered networks
  • From: dh <dh at metrohm.com>
  • Date: Thu, 22 Apr 2010 06:44:36 -0400 (EDT)
  • References: <hqmok8$4ch$1@smc.vnet.net>

On 21.04.2010 13:47, OmniaOpera wrote:
> 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
>
>
Hi,
what about if you define f3b like:

f3b[x_]:=f3a[x]-2

cheers, Daniel

-- 

Daniel Huber
Metrohm Ltd.
Oberdorfstr. 68
CH-9100 Herisau
Tel. +41 71 353 8585, Fax +41 71 353 8907
E-Mail:<mailto:dh at metrohm.com>
Internet:<http://www.metrohm.com>



  • Prev by Date: Re: Positions of Polynomials in expr?
  • Next by Date: Re: NDSolve cannot solve set of ODEs
  • Previous by thread: Re: Dynamic evaluation of layered networks
  • Next by thread: Re: Dynamic evaluation of layered networks