Open rizar opened 9 years ago
I agree that (1) seems to be the preferred. This would also ensure that DataStreamMonitoring
does not need any notion of Model
at all, which might be good for composability (some subsystem building a DataStreamMonitor
for a sub-graph without knowing about the final top-level model).
But to stay flexible and explicit, DataStreamMonotoring
could have an additional updates=None
argument. The docstring for this argument would IMHO also be a
good place to describe that it would scan the computational graph for update-annotations when no explicit updates are supplied.
Sounds good!
That sounds like a relatively easy fix, if you wish you could do it.
There is currently no way to push updates to the monitoring mechanism. This makes observing certain quantities impossible, if I am not missing anything, only in the case when the computation graph contains a scan with randomness in the inner graph. @jbornschein, was that your case?
Proposed solutions
1)
DataStreamMonitoring
uses theComputationGraph
interface to retrieve updates. In this case it can just use theget_theano_function
method which compiles a function with the updates from annotations automatically.2) The
Model
gets an additional methodget_updates
, to which the request fromDataStreamMonitoring
is made.At the first thought I liked the second way more, because thanks to this indirection the user can intercept
get_updates
request and change the default logic. We can make a keyword argument for the model that will override the updates extracted in the default way.But on the other hand,
DataStreamMonitoring
might be used to monitor something very simple like average input magnitude, and in this case the updates required for the whole computation graph are not required. The solution 2 will simply result into compilation failure.So (1) seems to be the only feasible way I see.