-
Notifications
You must be signed in to change notification settings - Fork 45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add interface points for accessing the internal state of an exported learning network composite model #644
Add interface points for accessing the internal state of an exported learning network composite model #644
Conversation
Codecov Report
@@ Coverage Diff @@
## for-0-point-19-release #644 +/- ##
==========================================================
+ Coverage 86.60% 86.81% +0.20%
==========================================================
Files 37 37
Lines 3352 3389 +37
==========================================================
+ Hits 2903 2942 +39
+ Misses 449 447 -2
Continue to review full report at Codecov.
|
The overall high level functionality seems to match what I had in mind and looks great from my perspective. I've added a high level test in that direction but it may be of little value, feel free to revert the commit if this is so. I am afraid I can't provide a huge feedback on the details of the implementation as I don't fully understand how things are chained together under the hood. I've tried to dig a bit in the learning network implementation but with the asynchrononisity I find it difficult to understand the internals. Especially, I am wondering if the results of a |
After reflection, I think the extra information should go into the report rather than the fitted_params. Strictly speaking @olivierlabayle Any objections to this change? I understand that in your use-case Another possibility is to allow writing to both report and fitted_params, but I don't see how to design this in a way that's not more complicated, and am not sure the extra complication is warranted. But perhaps you have a suggestion? |
@olivierlabayle By the way, thanks for the extra test.
The answer to the question I think you are asking is "yes". The call to the node is made immediately after Generally, the machines in a learning network and elsewhere cache data, unless they are constructed with A machine bound to a composite model (subtype Clear as mud, right? |
No problem at all to export the results to the |
Haha it's indeed hard to catch, I was actually wondering in a general manner as you describe second. From what I "imagine", a fit! of the composite model will necessary call each node in the computational graph to trigger the different fits on the appropriate data. Some nodes are not bound to a machine (static) so they cannot be cached right? Does it mean this kind of node might be evaluated (computed) multiple times if asked for multiple times? |
Perhaps there is some confusion about what "caching" means here. The only caching that takes place is for the benefit of training machines. A machine constructed with If you have an static node that performs an expensive computation, then the only benefit caching has is if the output of the node is needed as training data for a machine downstream. However, if you are just calling a node downstream of that static node, the static node will need to re-compute. Similarly, if Does that help? |
Allright, thank you for the clarification, that helps a lot! |
Note to self:
|
Comment to trigger notification to self. |
This PR is attempt to address some issues raised in JuliaAI/MLJ.jl#841.
Supposing you have a learning network that you would like to export as a new stand-alone model type
composite
. Having boundcomposite
to some data in a machinemach
, you would like to arrange thatfitted_params(mach)
report(mach)
will record some additional information about the internal state of the learning network that was built internally, when you calledfit!(mach)
.Specifically, this PR allows the following: Given any node
N
in the network, specified in the export process, you can arrange for the result ofN()
to be recorded infitted_params(mach)
report(mach)
. Naturally, the callN()
happens immediately after the network is fit (and before the internal data anonymization step that empties the source nodes immediately thereafter).Since
N
is called with no arguments, it will never see "production" data, which is a point of difference with thepredict
and/ortransform
nodes declared at export, which are always called on the production dataXnew
, as inpredict(mach, Xnew)
. However, this also meansN
can have multiple origin nodes (queryorigins
for details). This is indeed the case in the following example, recording a training error in the composite model report:(edited to reflect syntax adopted after discussions below)
This is preliminary proof of concept and criticism is most welcome.
The PR also needs a bit more unit testing.