Skip to content

Commit e74f1d0

Browse files
committed
adjust docstrings/docs to reflect verbosity change
1 parent 69d8d3e commit e74f1d0

File tree

3 files changed

+48
-33
lines changed

3 files changed

+48
-33
lines changed

docs/src/fit_update.md

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
### Training
55

66
```julia
7-
fit(learner, data; verbosity=1) -> model
7+
fit(learner, data; verbosity=...) -> model
88
```
99

1010
This is the typical `fit` pattern, applying in the case that [`LearnAPI.kind_of(learner)`](@ref)
@@ -25,9 +25,9 @@ Examples appear below.
2525
### Updating
2626

2727
```
28-
update(model, data; verbosity=..., :param1=new_value1, :param2=new_value2, ...) -> updated_model
29-
update_observations(model, new_data; verbosity=..., :param1=new_value1, ...) -> updated_model
30-
update_features(model, new_data; verbosity=..., :param1=new_value1, ...) -> updated_model
28+
update(model, data, :param1=>new_value1, :param2=>new_value2, ...; verbosity=...) -> updated_model
29+
update_observations(model, new_data, :param1=>new_value1, ...; verbosity=...) -> updated_model
30+
update_features(model, new_data, :param1=>new_value1, ...; verbosity=...) -> updated_model
3131
```
3232

3333
[`LearnAPI.Static()`](@ref) learners cannot be updated.
@@ -50,7 +50,7 @@ ŷ = predict(model, Distribution(), Xnew)
5050
LearnAPI.feature_importances(model)
5151

5252
# Add 50 iterations and predict again:
53-
model = update(model; n=150)
53+
model = update(model, n => 150)
5454
predict(model, Distribution(), X)
5555
```
5656

@@ -123,21 +123,21 @@ See also [Density Estimation](@ref).
123123

124124
Exactly one of the following must be implemented:
125125

126-
| method | fallback |
127-
|:--------------------------------------------|:---------|
128-
| [`fit`](@ref)`(learner, data; verbosity=1)` | none |
129-
| [`fit`](@ref)`(learner; verbosity=1)` | none |
126+
| method | fallback |
127+
|:-----------------------------------------------------------------------|:---------|
128+
| [`fit`](@ref)`(learner, data; verbosity=LearnAPI.default_verbosity())` | none |
129+
| [`fit`](@ref)`(learner; verbosity=LearnAPI.default_verbosity())` | none |
130130

131131
### Updating
132132

133-
| method | fallback | compulsory? |
134-
|:-------------------------------------------------------------------------------------|:---------|-------------|
135-
| [`update`](@ref)`(model, data; verbosity=1, hyperparameter_updates...)` | none | no |
136-
| [`update_observations`](@ref)`(model, new_data; verbosity=1, hyperparameter_updates...)` | none | no |
137-
| [`update_features`](@ref)`(model, new_data; verbosity=1, hyperparameter_updates...)` | none | no |
133+
| method | fallback | compulsory? |
134+
|:-------------------------------------------------------------------------------------------|:---------|-------------|
135+
| [`update`](@ref)`(model, data, hyperparameter_updates...; verbosity=...)` | none | no |
136+
| [`update_observations`](@ref)`(model, new_data, hyperparameter_updates...; verbosity=...)` | none | no |
137+
| [`update_features`](@ref)`(model, new_data, hyperparameter_updates...; verbosity=...)` | none | no |
138138

139-
There are some contracts governing the behaviour of the update methods, as they relate to
140-
a previous `fit` call. Consult the document strings for details.
139+
There are contracts governing the behaviour of the update methods, as they relate to a
140+
previous `fit` call. Consult the document strings for details.
141141

142142
## Reference
143143

src/fit_update.jl

Lines changed: 29 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# # FIT
22

33
"""
4-
fit(learner, data; verbosity=1)
5-
fit(learner; verbosity=1)
4+
fit(learner, data; verbosity=LearnAPI.default_verbosity())
5+
fit(learner; verbosity=LearnAPI.default_verbosity()))
66
77
In the case of the first signature, execute the machine learning or statistical algorithm
88
with configuration `learner` using the provided training `data`, returning an object,
@@ -51,7 +51,8 @@ Implementation of exactly one of the signatures is compulsory. Unless implementi
5151
[`LearnAPI.Descriminative()`](@ref) `fit`/`predict`/`transform` pattern,
5252
[`LearnAPI.kind_of(learner)`](@ref) will need to be suitably overloaded.
5353
54-
The `fit` signature must include `verbosity` with `1` as default.
54+
The `fit` signature must include the keyword argument `verbosity` with
55+
`LearnAPI.default_verbosity()` as default.
5556
5657
The LearnAPI.jl specification has nothing to say regarding `fit` signatures with more than
5758
two arguments. For convenience, for example, an implementation is free to implement a
@@ -74,7 +75,7 @@ function fit end
7475
# # UPDATE AND COUSINS
7576

7677
"""
77-
update(model, data, param_replacements...; verbosity=1)
78+
update(model, data, param_replacements...; verbosity=LearnAPI.default_verbosity())
7879
7980
Return an updated version of the `model` object returned by a previous [`fit`](@ref) or
8081
`update` call, but with the specified hyperparameter replacements, in the form `:p1 =>
@@ -104,9 +105,10 @@ See also [`fit`](@ref), [`update_observations`](@ref), [`update_features`](@ref)
104105
105106
# New implementations
106107
107-
Implementation is optional. The signature must include `verbosity`. It should be true that
108-
`LearnAPI.learner(newmodel) == newlearner`, where `newmodel` is the return value and
109-
`newlearner = LearnAPI.clone(learner, replacements...)`.
108+
Implementation is optional. The signature must include the `verbosity` keyword
109+
argument. It should be true that `LearnAPI.learner(newmodel) == newlearner`, where
110+
`newmodel` is the return value and `newlearner = LearnAPI.clone(learner,
111+
replacements...)`.
110112
111113
Cannot be implemented if [`LearnAPI.kind_of(learner)`](@ref)` == `LearnAPI.Static()`.
112114
@@ -118,10 +120,15 @@ See also [`LearnAPI.clone`](@ref)
118120
function update end
119121

120122
"""
121-
update_observations(model, new_data, param_replacements...; verbosity=1)
123+
update_observations(
124+
model,
125+
new_data,
126+
param_replacements...;
127+
verbosity=LearnAPI.default_verbosity(),
128+
)
122129
123130
Return an updated version of the `model` object returned by a previous [`fit`](@ref) or
124-
`update` call given the new observations present in `new_data`. One may additionally
131+
`update` call, given the new observations present in `new_data`. One may additionally
125132
specify hyperparameter replacements in the form `:p1 => value1, :p2 => value2, ...`.
126133
127134
```julia-repl
@@ -145,9 +152,10 @@ See also [`fit`](@ref), [`update`](@ref), [`update_features`](@ref).
145152
146153
# New implementations
147154
148-
Implementation is optional. The signature must include `verbosity`. It should be true that
149-
`LearnAPI.learner(newmodel) == newlearner`, where `newmodel` is the return value and
150-
`newlearner = LearnAPI.clone(learner, replacements...)`.
155+
Implementation is optional. The signature must include the `verbosity` keyword
156+
argument. It should be true that `LearnAPI.learner(newmodel) == newlearner`, where
157+
`newmodel` is the return value and `newlearner = LearnAPI.clone(learner,
158+
replacements...)`.
151159
152160
Cannot be implemented if [`LearnAPI.kind_of(learner)`](@ref)` == `LearnAPI.Static()`.
153161
@@ -159,7 +167,11 @@ See also [`LearnAPI.clone`](@ref).
159167
function update_observations end
160168

161169
"""
162-
update_features(model, new_data, param_replacements...; verbosity=1)
170+
update_features(
171+
model,
172+
new_data,
173+
param_replacements,...;
174+
verbosity=LearnAPI.default_verbosity(),
163175
)
164176
165177
Return an updated version of the `model` object returned by a previous [`fit`](@ref) or
@@ -177,9 +189,10 @@ See also [`fit`](@ref), [`update`](@ref), [`update_features`](@ref).
177189
178190
# New implementations
179191
180-
Implementation is optional. The signature must include `verbosity`. It should be true that
181-
`LearnAPI.learner(newmodel) == newlearner`, where `newmodel` is the return value and
182-
`newlearner = LearnAPI.clone(learner, replacements...)`.
192+
Implementation is optional. The signature must include the `verbosity` keyword
193+
argument. It should be true that `LearnAPI.learner(newmodel) == newlearner`, where
194+
`newmodel` is the return value and `newlearner = LearnAPI.clone(learner,
195+
replacements...)`.
183196
184197
Cannot be implemented if [`LearnAPI.kind_of(learner)`](@ref)` == `LearnAPI.Static()`.
185198

src/preferences.jl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,13 @@ INFO_VERBOSITY_WILL_BE(verbosity) =
88
"""
99
LearnAPI.default_verbosity()
1010
11-
Return the default verbosity for training LearnAPI learners.
11+
Return the default LearnAPI verbosity level.
1212
1313
The value is determined at compile time by a Preferences.jl-style preference, with key
1414
"verbosity".
1515
16+
If `verbosity=0`, only warnings are displayed; `verbosity=-1` suppresses warnings.
17+
1618
"""
1719
default_verbosity() = VERBOSITY
1820

0 commit comments

Comments
 (0)