Skip to content

Commit 3b31884

Browse files
authored
Merge pull request #44 from JuliaAI/dev
Update docs. No new release
2 parents d07c2e0 + d21c403 commit 3b31884

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

69 files changed

+3589
-2087
lines changed

.github/codecov.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
coverage:
2+
status:
3+
project:
4+
default:
5+
threshold: 0.5%
6+
removed_code_behavior: fully_covered_patch
7+
patch:
8+
default:
9+
target: 80

.github/workflows/SpellCheck.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
name: Spell Check
2+
3+
on: [pull_request]
4+
5+
jobs:
6+
typos-check:
7+
name: Spell Check with Typos
8+
runs-on: ubuntu-latest
9+
steps:
10+
- name: Checkout Actions Repository
11+
uses: actions/checkout@v4
12+
- name: Check spelling
13+
uses: crate-ci/typos@master

.github/workflows/ci.yml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
fail-fast: false
1818
matrix:
1919
version:
20-
- '1.6'
20+
- '1.10' # LTS release
2121
- '1' # automatically expands to the latest stable 1.x release of Julia.
2222
os:
2323
- ubuntu-latest
@@ -44,9 +44,11 @@ jobs:
4444
env:
4545
JULIA_NUM_THREADS: 2
4646
- uses: julia-actions/julia-processcoverage@v1
47-
- uses: codecov/codecov-action@v1
47+
- uses: codecov/codecov-action@v4
4848
with:
49-
file: lcov.info
49+
token: ${{ secrets.CODECOV_TOKEN }}
50+
fail_ci_if_error: false
51+
verbose: true
5052
docs:
5153
name: Documentation
5254
runs-on: ubuntu-latest
@@ -65,4 +67,4 @@ jobs:
6567
using Documenter: DocMeta, doctest
6668
using LearnAPI
6769
DocMeta.setdocmeta!(LearnAPI, :DocTestSetup, :(using LearnAPI); recursive=true)
68-
doctest(LearnAPI)'
70+
doctest(LearnAPI)'

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
MIT License Copyright (c) 2021 - JuliaAI
3+
MIT License Copyright (c) 2024 - Anthony Blaom
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

Project.toml

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,11 @@ uuid = "92ad9a40-7767-427a-9ee6-6e577f1266cb"
33
authors = ["Anthony D. Blaom <[email protected]>"]
44
version = "0.1.0"
55

6-
[deps]
7-
InteractiveUtils = "b77e0a4c-d291-57a0-90e8-8db25a27a240"
8-
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
9-
106
[compat]
11-
julia = "1.6"
7+
julia = "1.10"
128

139
[extras]
14-
SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"
1510
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
1611

1712
[targets]
18-
test = ["SparseArrays", "Test"]
13+
test = ["Test",]

README.md

Lines changed: 43 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,27 +2,53 @@
22

33
A base Julia interface for machine learning and statistics
44

5+
[![Lifecycle:Maturing](https://img.shields.io/badge/Lifecycle-Maturing-007EC6)](ROADMAP.md)
6+
[![Build Status](https://github.com/JuliaAI/LearnAPI.jl/workflows/CI/badge.svg)](https://github.com/JuliaAI/LearnAPI.jl/actions)
7+
[![codecov](https://codecov.io/gh/JuliaAI/LearnAPI.jl/graph/badge.svg?token=9IWT9KYINZ)](https://codecov.io/gh/JuliaAI/LearnAPI.jl?branch=dev)
8+
[![Docs](https://img.shields.io/badge/docs-dev-blue.svg)](https://juliaai.github.io/LearnAPI.jl/dev/)
59

6-
**Devlopement Status:**
10+
Comprehensive documentation is [here](https://juliaai.github.io/LearnAPI.jl/dev/).
711

8-
- [X] Detailed proposal stage ([this
9-
documentation](https://juliaai.github.io/LearnAPI.jl/dev/)).
10-
- [ ] Initial feedback stage (opened mid-January, 2023). General feedback can be provided at [this Julia Discourse thread](https://discourse.julialang.org/t/ann-learnapi-jl-proposal-for-a-basement-level-machine-learning-api/93048/20).
11-
- [ ] Implement feedback and finish "To do" list (below)
12-
- [ ] Proof of concept implementation
13-
- [ ] Polish
14-
- [ ] **Register 0.2.0**
12+
New contributions welcome. See the [road map](ROADMAP.md).
1513

16-
You can join a discussion on the LearnAPI proposal at [this](https://discourse.julialang.org/t/ann-learnapi-jl-proposal-for-a-basement-level-machine-learning-api/93048) Julia Discourse thread.
14+
## Code snippet
1715

18-
To do:
16+
Configure a machine learning algorithm:
1917

20-
- [ ] Add methods to create/save persistent representation of learned parameters
21-
- [ ] Add more repo tests
22-
- [ ] Add methods to test an implementation
23-
- [ ] Add user guide ("Common Implementation Patterns" section of manual)
18+
```julia
19+
julia> ridge = Ridge(lambda=0.1)
20+
```
2421

25-
[![Build Status](https://github.com/JuliaAI/LearnAPI.jl/workflows/CI/badge.svg)](https://github.com/JuliaAI/LearnAPI.jl/actions)
26-
[![Coverage](https://codecov.io/gh/JuliaAI/LearnAPI.jl/branch/master/graph/badge.svg)](https://codecov.io/github/JuliaAI/LearnAPI.jl?branch=master)
27-
[![Docs](https://img.shields.io/badge/docs-dev-blue.svg)](https://juliaai.github.io/LearnAPI.jl/dev/)
22+
Inspect available functionality:
23+
24+
```
25+
julia> @functions ridge
26+
(fit, LearnAPI.learner, LearnAPI.strip, obs, LearnAPI.features, LearnAPI.target, predict, LearnAPI.coefficients)
27+
```
28+
29+
Train:
30+
31+
```julia
32+
julia> model = fit(ridge, data)
33+
```
34+
35+
Predict:
36+
37+
```julia
38+
julia> predict(model, data)[1]
39+
"virginica"
40+
```
41+
42+
Predict a probability distribution ([proxy](https://juliaai.github.io/LearnAPI.jl/dev/kinds_of_target_proxy/#proxy_types) for the target):
43+
44+
```julia
45+
julia> predict(model, Distribution(), data)[1]
46+
UnivariateFinite{Multiclass{3}}(setosa=>0.0, versicolor=>0.25, virginica=>0.75)
47+
```
48+
49+
## Credits
50+
51+
Created by Anthony Blaom, in cooperation with Cameron Bieganek and other [members of the
52+
Julia
53+
community](https://discourse.julialang.org/t/ann-learnapi-jl-proposal-for-a-basement-level-machine-learning-api/93048).
2854

ROADMAP.md

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# Road map
2+
3+
- [ ] Mock up a challenging `update` use-case: controlling an iterative algorithm that
4+
wants, for efficiency, to internally compute the out-of-sample predictions that will
5+
be for used to *externally* determined early stopping cc: @jeremiedb
6+
7+
- [ ] Get code coverage to 100% (see next item)
8+
9+
- [ ] Add to this repo or a utility repo methods to test a valid implementation of
10+
LearnAPI.jl
11+
12+
- [ ] Flush out "Common Implementation Patterns". The current plan is to mock up example
13+
implementations, and add them as LearnAPI.jl tests, with links to the test file from
14+
"Common Implementation Patterns". As real-world implementations roll out, we could
15+
increasingly point to those instead, to conserve effort
16+
- [x] regression
17+
- [ ] classification
18+
- [ ] clustering
19+
- [x] gradient descent
20+
- [x] iterative algorithms
21+
- [ ] incremental algorithms
22+
- [ ] dimension reduction
23+
- [x] feature engineering
24+
- [x] static algorithms
25+
- [ ] missing value imputation
26+
- [ ] transformers
27+
- [x] ensemble algorithms
28+
- [ ] time series forecasting
29+
- [ ] time series classification
30+
- [ ] survival analysis
31+
- [ ] density estimation
32+
- [ ] Bayesian algorithms
33+
- [ ] outlier detection
34+
- [ ] collaborative filtering
35+
- [ ] text analysis
36+
- [ ] audio analysis
37+
- [ ] natural language processing
38+
- [ ] image processing
39+
- [ ] meta-algorithms
40+
41+
- [ ] In a utility package provide:
42+
- [ ] Methods to facilitate common-use case data interfaces: support simultaneously
43+
`fit` data of the form `data = (X, y)` where `X` is table *or* matrix, and `data` a
44+
table with target specified by hyperparameter; here `obs` will return a thin wrapping
45+
of the matrix of `X`, the target `y`, and the names of all fields. We can have
46+
options to make `X` a concrete array or an adjoint, depending on what is more
47+
efficient for the algorithm.

docs/Project.toml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
[deps]
22
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
3+
DocumenterInterLinks = "d12716ef-a0f6-4df4-a9f1-a5a34e75c656"
4+
LearnAPI = "92ad9a40-7767-427a-9ee6-6e577f1266cb"
5+
MLUtils = "f1d291b0-491e-4a28-83b9-f70985020b54"
36
ScientificTypesBase = "30f210dd-8aff-4c5f-94ba-8e64358c1161"
47
Tables = "bd369af6-aec1-5ad0-b16a-f7cc5008161c"
58

69
[compat]
7-
Documenter = "^0.27"
8-
julia = "1"
10+
Documenter = "1"
11+
julia = "1.10"

docs/make.jl

Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,39 @@
11
using Documenter
22
using LearnAPI
33
using ScientificTypesBase
4+
using DocumenterInterLinks
45

5-
const REPO="github.com/JuliaAI/LearnAPI.jl"
6+
const REPO = Remotes.GitHub("JuliaAI", "LearnAPI.jl")
67

7-
makedocs(;
8+
makedocs(
89
modules=[LearnAPI,],
9-
format=Documenter.HTML(prettyurls = get(ENV, "CI", nothing) == "true"),
10+
format=Documenter.HTML(
11+
prettyurls = true,#get(ENV, "CI", nothing) == "true",
12+
collapselevel = 1,
13+
),
1014
pages=[
11-
"Overview" => "index.md",
12-
"Goals and Approach" => "goals_and_approach.md",
15+
"Home" => "index.md",
1316
"Anatomy of an Implementation" => "anatomy_of_an_implementation.md",
14-
"Reference" => "reference.md",
15-
"Fit, update and ingest" => "fit_update_and_ingest.md",
16-
"Predict and other operations" => "operations.md",
17-
"Accessor Functions" => "accessor_functions.md",
18-
"Optional Data Interface" => "optional_data_interface.md",
19-
"Algorithm Traits" => "algorithm_traits.md",
17+
"Reference" => [
18+
"Overview" => "reference.md",
19+
"fit/update" => "fit_update.md",
20+
"predict/transform" => "predict_transform.md",
21+
"Kinds of Target Proxy" => "kinds_of_target_proxy.md",
22+
"obs and Data Interfaces" => "obs.md",
23+
"target/weights/features" => "target_weights_features.md",
24+
"Accessor Functions" => "accessor_functions.md",
25+
"Learner Traits" => "traits.md",
26+
],
2027
"Common Implementation Patterns" => "common_implementation_patterns.md",
2128
"Testing an Implementation" => "testing_an_implementation.md",
2229
],
23-
repo="https://$REPO/blob/{commit}{path}#L{line}",
24-
sitename="LearnAPI.jl"
30+
sitename="LearnAPI.jl",
31+
warnonly = [:cross_references, :missing_docs],
32+
repo = Remotes.GitHub("JuliaAI", "LearnAPI.jl"),
2533
)
2634

2735
deploydocs(
28-
; repo=REPO,
2936
devbranch="dev",
3037
push_preview=false,
38+
repo="github.com/JuliaAI/LearnAPI.jl.git",
3139
)

docs/src/accessor_functions.md

Lines changed: 44 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,53 @@
1-
# Accessor Functions
1+
# [Accessor Functions](@id accessor_functions)
22

3-
> **Summary.** While byproducts of training are ordinarily recorded in the `report`
4-
> component of the output of `fit`/`update!`/`ingest!`, some families of algorithms report an
5-
> item that is likely shared by multiple algorithm types, and it is useful to have common
6-
> interface for accessing these directly. Training losses and feature importances are two
7-
> examples.
3+
The sole argument of an accessor function is the output, `model`, of
4+
[`fit`](@ref). Learners are free to implement any number of these, or none of them. Only
5+
`LearnAPI.strip` has a fallback, namely the identity.
6+
7+
- [`LearnAPI.learner(model)`](@ref)
8+
- [`LearnAPI.extras(model)`](@ref)
9+
- [`LearnAPI.strip(model)`](@ref)
10+
- [`LearnAPI.coefficients(model)`](@ref)
11+
- [`LearnAPI.intercept(model)`](@ref)
12+
- [`LearnAPI.tree(model)`](@ref)
13+
- [`LearnAPI.trees(model)`](@ref)
14+
- [`LearnAPI.feature_names(model)`](@ref)
15+
- [`LearnAPI.feature_importances(model)`](@ref)
16+
- [`LearnAPI.training_losses(model)`](@ref)
17+
- [`LearnAPI.out_of_sample_losses(model)`](@ref)
18+
- [`LearnAPI.predictions(model)`](@ref)
19+
- [`LearnAPI.out_of_sample_indices(model)`](@ref)
20+
- [`LearnAPI.training_scores(model)`](@ref)
21+
- [`LearnAPI.components(model)`](@ref)
22+
23+
Learner-specific accessor functions may also be implemented. The names of all accessor
24+
functions are included in the list returned by [`LearnAPI.functions(learner)`](@ref).
25+
26+
## Implementation guide
27+
28+
All new implementations must implement [`LearnAPI.learner`](@ref). While, all others are
29+
optional, any implemented accessor functions must be added to the list returned by
30+
[`LearnAPI.functions`](@ref).
31+
32+
33+
## Reference
834

935
```@docs
36+
LearnAPI.learner
37+
LearnAPI.extras
38+
LearnAPI.strip
39+
LearnAPI.coefficients
40+
LearnAPI.intercept
41+
LearnAPI.tree
42+
LearnAPI.trees
43+
LearnAPI.feature_names
1044
LearnAPI.feature_importances
1145
LearnAPI.training_losses
46+
LearnAPI.out_of_sample_losses
47+
LearnAPI.predictions
48+
LearnAPI.out_of_sample_indices
1249
LearnAPI.training_scores
13-
LearnAPI.training_labels
50+
LearnAPI.components
1451
```
1552

1653

0 commit comments

Comments
 (0)