JuliaAI / MLJTuning.jl

Hyperparameter optimization algorithms for use in the MLJ machine learning framework
MIT License
67 stars 12 forks source link

Incrementing `n` by 1 is adding 2 models to history #128

Closed ablaom closed 3 years ago

ablaom commented 3 years ago
dtc = DecisionTreeClassifier()
r   = range(dtc, :max_depth, lower=1, upper=50);

tmodel = TunedModel(model=dtc, ranges=[r, ],
                tuning=Grid(resolution=50),
                measure=cross_entropy,
                n=48);
mach = machine(tmodel, (@load_iris)...)

julia> fit!(mach, verbosity=2);
[ Info: Updating Machine{ProbabilisticTunedModel{Grid,…},…} @969.
[ Info: Attempting to add 1 models to search, bringing total to 49. 
measurement: 9.611640903764574
measurement: 9.611640903764574
[ Info: Training Machine{DecisionTreeClassifier,…} @695.

@assert length(report(mach).history) == 48

tmodel.n = 49
fit!(mach, verbosity=2);

julia> length(report(mach).history)
50

Wierd thing is that if I use intial n=10 and increment to n=11, the issue is absent.