Skip to content

Commit a33bea4

Browse files
authored
Merge pull request #31 from JuliaAI/update_observations
Add a perceptron classifier to examples
2 parents 43db086 + 458b03c commit a33bea4

File tree

8 files changed

+410
-12
lines changed

8 files changed

+410
-12
lines changed

ROADMAP.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
- [x] regression
1717
- [ ] classification
1818
- [ ] clustering
19-
- [ ] gradient descent
19+
- [x] gradient descent
2020
- [x] iterative algorithms
2121
- [ ] incremental algorithms
2222
- [ ] dimension reduction

docs/src/common_implementation_patterns.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,12 @@ implementations fall into one (or more) of the following informally understood p
2222

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

25-
- Classification: Supervised learners for categorical targets
25+
- [Classification](@ref): Supervised learners for categorical targets
2626

2727
- Clusterering: Algorithms that group data into clusters for classification and
2828
possibly dimension reduction. May be true learners (generalize to new data) or static.
2929

30-
- Gradient Descent: Including neural networks.
30+
- [Gradient Descent](@ref): Including neural networks.
3131

3232
- [Iterative Algorithms](@ref)
3333

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,5 @@
11
# Classification
2+
3+
See these examples from tests:
4+
5+
- [perceptron classifier](https://github.com/JuliaAI/LearnAPI.jl/blob/dev/test/integration/gradient_descent.jl)
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Gradient Descent
2+
3+
See [this
4+
example](https://github.com/JuliaAI/LearnAPI.jl/blob/dev/test/integration/gradient_descent.jl)
5+
from tests.
Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# Iterative Algorithms
22

3-
See [this
4-
example](https://github.com/JuliaAI/LearnAPI.jl/blob/dev/test/integration/ensembling.jl)
5-
from tests.
3+
See these examples from tests:
4+
5+
- [bagged ensembling](https://github.com/JuliaAI/LearnAPI.jl/blob/dev/test/integration/ensembling.jl)
6+
7+
- [perceptron classifier](https://github.com/JuliaAI/LearnAPI.jl/blob/dev/test/integration/gradient_descent.jl)

test/integration/ensembling.jl

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -194,13 +194,14 @@ Xtest = Tables.subset(X, test)
194194
ŷ7 = predict(model, Xtest)
195195

196196
# compare with cold restart:
197-
model = fit(LearnAPI.clone(algorithm; n=7), Xtrain, y[train]; verbosity=0);
198-
@test ŷ7 predict(model, Xtest)
197+
model_cold = fit(LearnAPI.clone(algorithm; n=7), Xtrain, y[train]; verbosity=0);
198+
@test ŷ7 predict(model_cold, Xtest)
199199

200-
# test cold restart if another hyperparameter is changed:
200+
# test that we get a cold restart if another hyperparameter is changed:
201201
model2 = update(model, Xtrain, y[train]; atom=Ridge(0.05))
202-
algorithm2 = LearnAPI.clone(LearnAPI.algorithm(model); atom=Ridge(0.05))
203-
@test predict(model, Xtest) predict(model2, Xtest)
202+
algorithm2 = Ensemble(Ridge(0.05); n=7, rng)
203+
model_cold = fit(algorithm2, Xtrain, y[train]; verbosity=0)
204+
@test predict(model2, Xtest) predict(model_cold, Xtest)
204205

205206
end
206207

0 commit comments

Comments
 (0)