MLJ.jl icon indicating copy to clipboard operation
MLJ.jl copied to clipboard

Confusing Julia code in adding_models_for_general_use.md

Open jcsahnwaldt opened this issue 2 years ago • 1 comments

Line 159 of adding_models_for_general_use.md says:

clean!(clean!(model)) == clean!(model)

I guess the intention is to specify that only the first call of clean!(model) may modify model, and any subsequent calls must not make further changes to model. But clean!() doesn't return a model, it returns a string containing warnings. clean!(clean!(model)) doesn't even compile.

I'm afraid I can't suggest a good fix for the problem, because I don't know if there's a good way to express as Julia code the requirement that subsequent calls of clean!() must not change the model.

I guess this requirement also implies that subsequent calls of clean!() must return an empty string, but I'm not sure.

jcsahnwaldt avatar Oct 02 '23 14:10 jcsahnwaldt

Good catch, thanks. Yes the intention is that calling clean!(model) immediately after clean!(model) should not mutate model. So,

clean!(model)
clone = deepcopy(model)
clean!(model)
@assert model == clone

ablaom avatar Oct 03 '23 19:10 ablaom