Skip to content

Commit 8f6a0dd

Browse files
authored
Change some comments into proper docstrings
1 parent 9cf959d commit 8f6a0dd

File tree

1 file changed

+48
-14
lines changed

1 file changed

+48
-14
lines changed

src/model_api.jl

Lines changed: 48 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1-
# every model interface must implement a `fit` method of the form
2-
# `fit(model, verb::Integer, training_args...) -> fitresult, cache, report`
1+
"""
2+
every model interface must implement a `fit` method of the form
3+
`fit(model, verb::Integer, training_args...) -> fitresult, cache, report`
4+
"""
35
function fit end
46

57
# fallback for static transformations
@@ -8,33 +10,65 @@ fit(::Static, ::Integer, a...) = (nothing, nothing, nothing)
810
# fallbacks for supervised models that don't support sample weights:
911
fit(m::Supervised, verb::Integer, X, y, w) = fit(m, verb, X, y)
1012

11-
# this operation can be optionally overloaded to provide access to
12-
# fitted parameters (eg, coeficients of linear model):
13+
"""
14+
`fitted_params` can be optionally overloaded to provide access to
15+
fitted parameters (eg, coeficients of linear model):
16+
"""
1317
fitted_params(::Model, fitres) = (fitresult=fitres,)
1418

15-
# each model interface may overload the following refitting method:
19+
"""
20+
each model interface may overload the `update` refitting method
21+
"""
1622
update(m::Model, verb::Integer, fitres, cache, a...) = fit(m, verb, a...)
1723

18-
# stub for online learning method update method
24+
"""
25+
each model interface may overload the `update_data` refitting method for online learning
26+
"""
1927
function update_data end
2028

21-
# supervised methods must implement the predict operation; additionally,
22-
# probabilistic supervised models may overload one or more of
23-
# `predict_mode`, `predict_median` and `predict_mean`
29+
"""
30+
supervised methods must implement the `predict` operation
31+
"""
2432
function predict end
33+
34+
"""
35+
probabilistic supervised models may overload `predict_mean`
36+
"""
2537
function predict_mean end
38+
39+
"""
40+
probabilistic supervised models may overload `predict_mode`
41+
"""
2642
function predict_mode end
43+
44+
"""
45+
probabilistic supervised models may overload `predict_median`
46+
"""
2747
function predict_median end
2848

29-
# unsupervised methods must implement the transform operation and
30-
# may implement the inverse_transform operation
49+
"""
50+
unsupervised methods must implement the `transform` operation
51+
"""
3152
function transform end
53+
54+
"""
55+
unsupervised methods may implement the `inverse_transform` operation
56+
"""
3257
function inverse_transform end
3358

34-
# models can optionally overload these for enable serialization in a
35-
# custom format:
59+
"""
60+
models can optionally overload `save` to enable serialization in a
61+
custom format
62+
"""
3663
function save end
64+
65+
"""
66+
models can optionally overload `restore` to enable serialization in a
67+
custom format
68+
"""
3769
function restore end
3870

39-
# operations implemented by some meta-models:
71+
"""
72+
some meta-models may choose to implement the `evaluate` operations
73+
"""
4074
function evaluate end

0 commit comments

Comments
 (0)