January 2020
Intermediate to advanced
532 pages
13h 31m
English
Let's also take a look at the ScikitLearn.jl package, which defines a consistent API for fitting machine learning models and doing prediction.
The following is how the FitBit type is defined:
""" `FitBit(model)` will behave just like `model`, but also supports`isfit(fb)`, which returns true IFF `fit!(model, ...)` has been called """mutable struct FitBit model isfit::Bool FitBit(model) = new(model, false)endfunction fit!(fb::FitBit, args...; kwargs...) fit!(fb.model, args...; kwargs...) fb.isfit = true fbendisfit(fb::FitBit) = fb.isfit
Here, we can see that the FitBit object contains a model object and that it adds a new functionality that keeps track of whether a model has been fitted or not:
@forward ...
Read now
Unlock full access