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

alan-turing-institute / MLJTuning.jl / 86

19 Mar 2020 - 4:43 coverage: 83.951% (+3.5%) from 80.455%
86

Pull #21

travis-ci-com

9181eb84f9c35729a3bad740fb7f9d93?size=18&default=identiconweb-flow
add tests and fixes for model metadata enhancement
Pull Request #21: Enhancements to the tuning interface

19 of 21 new or added lines in 3 files covered. (90.48%)

204 of 243 relevant lines covered (83.95%)

239.65 hits per line

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

81.82
/src/tuning_strategy_interface.jl
1
abstract type TuningStrategy <: MLJBase.MLJType end
2
MLJBase.show_as_constructed(::Type{<:TuningStrategy}) = true
!
3

4
# for initialization of state (compulsory)
5
setup(tuning::TuningStrategy, model, range, verbosity) = range
9×
6

7
# for building each element of the history:
8
result(tuning::TuningStrategy, history, state, e, metadata) =
3,138×
9
    (measure=e.measure, measurement=e.measurement)
10

11
# for generating batches of new models and updating the state (but not
12
# history):
13
function models! end
14

15
# for extracting the optimal model (and its performance) from the
16
# history:
17
function best(tuning::TuningStrategy, history)
18
   measurements = [h[2].measurement[1] for h in history]
463×
19
   measure = first(history)[2].measure[1]
20
   if orientation(measure) == :score
206×
21
       measurements = -measurements
22
   end
23
   best_index = argmin(measurements)
1,626×
24
   return history[best_index]
166×
25
end
26

27
# for selecting what to report to the user apart from the optimal
28
# model:
29
tuning_report(tuning::TuningStrategy, history, state) = (history=history,)
90×
30

31
# for declaring the default number of models to evaluate:
32
function default_n(tuning::TuningStrategy, range)
33
    try
63×
34
        length(range)
35×
35
    catch MethodError
NEW
36
        DEFAULT_N
!
37
    end
38
end
39

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