JuliaAI / JuliaAI/MLJBase.jl

Control caching of composite models

Open
#756 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

  • #759 by @olivierlabayle — closed without merging
design discussion enhancement
Dominant language
Julia
Stars
163
Forks
46
Avg merge
1d 18h
Merged PRs (30d)
5

Description

Hi,

Problem description

I have just had the late realization that setting cache=false for a composite model will not transfer to all sub machines built at fit time.

using MLJBase
using MLJLinearModels

n = 100
X = MLJBase.table(rand(n, 3))
y = rand(n)
stack = Stack(metalearner=LinearRegressor(),
    model1 = LinearRegressor())

mach = machine(stack, X, y, cache=false)
fit!(mach, verbosity=0)

# Top level machine
@assert !isdefined(mach, :data) # not defined : ok
mach.cache # contains data: ?

# Any submachine
submachines = report(mach).machines
for submach in submachines
    @assert isdefined(submach, :data)
end

I am currently working with very big Stacks and I think this is the main reason for which I run out of memory.

Ideas:
  • Of course I guess there is the possibility of adding a hyperparameter to the composite model that can be transferred after to the machine definitions. This would probably solve my personnal issue (and would be a short term solution) however I don't think this is ideal in the long term because any user defined composite model will have to add this hyperparameter.

  • More generally I think this issue arises from the current impossibility(?) of communication between the machine and its submachines in the current design. If I am not mistaken we will have the same problem with computational resources as briefly raised here.

A vague idea would be to define the learning graph in a method like machine(m::MyComposite, args...) instead of the current fit.

What are your thoughts?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing machine(...), fit!, and report(mach).machines in the composite-model path, using the supplied Stack example to reproduce cache=false behavior. Determine how caching should propagate to submachines, including user-defined composite models; done requires an agreed design and verification that submachines do not retain unintended training data.

Written by the indexing model from the issue text.

Assessment

Tech stack
julia
Domain
machine-learning, performance
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.