Coveralls logob
Coveralls logo
  • Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

alan-turing-institute / MLJTuning.jl / 95

26 Mar 2020 - 3:51 coverage: 81.702% (-0.9%) from 82.573%
95

Pull #26

travis-ci-com

9181eb84f9c35729a3bad740fb7f9d93?size=18&default=identiconweb-flow
update docs
Pull Request #26: Add n_remaining argument to models!

19 of 22 new or added lines in 4 files covered. (86.36%)

192 of 235 relevant lines covered (81.7%)

206.03 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

84.21
/src/strategies/explicit.jl
1
mutable struct Explicit <: TuningStrategy end
84×
2

3
mutable struct ExplicitState{R,N}
4
    range::R               # a model-generating iterator
49×
5
    next::Union{Nothing,N} # to hold output of `iterate(range)`
6
end
7

NEW
8
ExplicitState(r::R, ::Nothing) where R = ExplicitState{R,Nothing}(r,nothing)
!
NEW
9
ExplictState(r::R, n::N) where {R,N} = ExplicitState{R,Union{Nothing,N}}(r,n)
!
10

11
function MLJTuning.setup(tuning::Explicit, model, range, verbosity)
12
    next = iterate(range)
49×
13
    return ExplicitState(range, next)
35×
14
end
15

16
# models! returns all available models in the range at once:
17
function MLJTuning.models!(tuning::Explicit,
18
                           model,
19
                           history,
20
                           state,
21
                           n_remaining,
22
                           verbosity)
23

24
    range, next  = state.range, state.next
77×
25

26
    next === nothing && return nothing
44×
27

28
    m, s = next
45×
29
    models = [m, ]
36×
30

31
    next = iterate(range, s)
36×
32

33
    i = 1 # current length of `models`
34
    while i < n_remaining
420×
35
        next === nothing && break
308×
36
        m, s = next
37
        push!(models, m)
38
        i += 1
39
        next = iterate(range, s)
300×
40
    end
41

42
    state.next = next
42×
43

44
    return models
36×
45

46
end
47

48
function default_n(tuning::Explicit, range)
49
    try
40×
50
        length(range)
20×
51
    catch MethodError
NEW
52
        DEFAULT_N
!
53
    end
54
end
Troubleshooting · Open an Issue · Sales · Support · ENTERPRISE · CAREERS · STATUS
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2023 Coveralls, Inc