Skip to content

Commit 77de486

Browse files
committed
update Anatomy of an Implementation re verbosity
1 parent e74f1d0 commit 77de486

File tree

6 files changed

+17
-10
lines changed

6 files changed

+17
-10
lines changed

docs/src/anatomy_of_an_implementation.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ Note that we also include `learner` in the struct, for it must be possible to re
124124
The implementation of `fit` looks like this:
125125

126126
```@example anatomy
127-
function LearnAPI.fit(learner::Ridge, data; verbosity=1)
127+
function LearnAPI.fit(learner::Ridge, data; verbosity=LearnAPI.default_verbosity())
128128
X, y = data
129129
130130
# data preprocessing:
@@ -503,7 +503,7 @@ methods - one to handle "regular" input, and one to handle the pre-processed dat
503503
(observations) which appears first below:
504504

505505
```@example anatomy2
506-
function LearnAPI.fit(learner::Ridge, observations::RidgeFitObs; verbosity=1)
506+
function LearnAPI.fit(learner::Ridge, observations::RidgeFitObs; verbosity=LearnAPI.default_verbosity())
507507
508508
lambda = learner.lambda
509509

docs/src/common_implementation_patterns.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ which introduces the main interface objects and terminology.
1111
Although an implementation is defined purely by the methods and traits it implements, many
1212
implementations fall into one (or more) of the informally understood patterns or tasks
1313
below. While some generally fall into one of the core `Descriminative`, `Generative` or
14-
`Static` patterns detailed [here](@id kinds of learner), there are exceptions (such as
14+
`Static` patterns detailed [here](@id kinds_of_learner), there are exceptions (such as
1515
clustering, which has both `Descriminative` and `Static` variations).
1616

1717
- [Regression](@ref): Supervised learners for continuous targets

docs/src/examples.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ struct RidgeFitted{T,F}
3232
named_coefficients::F
3333
end
3434

35-
function LearnAPI.fit(learner::Ridge, data; verbosity=1)
35+
function LearnAPI.fit(learner::Ridge, data; verbosity=LearnAPI.default_verbosity())
3636
X, y = data
3737

3838
# data preprocessing:
@@ -129,7 +129,11 @@ function LearnAPI.obs(::Ridge, data)
129129
end
130130
LearnAPI.obs(::Ridge, observations::RidgeFitObs) = observations
131131

132-
function LearnAPI.fit(learner::Ridge, observations::RidgeFitObs; verbosity=1)
132+
function LearnAPI.fit(
133+
learner::Ridge,
134+
observations::RidgeFitObs;
135+
verbosity=LearnAPI.default_verbosity(),
136+
)
133137

134138
lambda = learner.lambda
135139

@@ -226,7 +230,7 @@ frontend = FrontEnds.Saffron()
226230
LearnAPI.obs(learner::Ridge, data) = FrontEnds.fitobs(learner, data, frontend)
227231
LearnAPI.obs(model::RidgeFitted, data) = obs(model, data, frontend)
228232

229-
function LearnAPI.fit(learner::Ridge, observations::FrontEnds.Obs; verbosity=1)
233+
function LearnAPI.fit(learner::Ridge, observations::FrontEnds.Obs; verbosity=LearnAPI.default_verbosity())
230234

231235
lambda = learner.lambda
232236

docs/src/fit_update.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,12 @@ returns one of:
1414
- [`LearnAPI.Generative()`](@ref)
1515

1616
```
17-
fit(learner; verbosity=1) -> static_model
17+
fit(learner; verbosity=...) -> static_model
1818
```
1919

20-
This pattern applies in the case [`LearnAPI.kind_of(learner)`](@ref) returns [`LearnAPI.Static()`](@ref).
20+
This pattern applies in the case [`LearnAPI.kind_of(learner)`](@ref) returns:
21+
22+
- [`LearnAPI.Static()`](@ref)
2123

2224
Examples appear below.
2325

docs/src/reference.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,17 +217,18 @@ Most learners will also implement [`predict`](@ref) and/or [`transform`](@ref).
217217

218218
## Utilities
219219

220-
221220
- [`LearnAPI.is_learner`](@ref)
222221
- [`clone`](@ref): for cloning a learner with specified hyperparameter replacements.
223222
- [`@trait`](@ref): for simultaneously declaring multiple traits
224223
- [`@functions`](@ref): for listing functions available for use with a learner
224+
- [`LearnAPI.default_verbosity`](@ref): get/reset the default verbosity
225225

226226
```@docs
227227
LearnAPI.is_learner
228228
clone
229229
@trait
230230
@functions
231+
LearnAPI.default_verbosity
231232
```
232233

233234
---

docs/src/traits.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
2# [Learner Traits](@id traits)
1+
# [Learner Traits](@id traits)
22

33
Learner traits are simply functions whose sole argument is a learner.
44

0 commit comments

Comments
 (0)