Skip to content

Commit e1d1a57

Browse files
authored
Merge branch 'master' into st/examples--deep-kernel-learning
2 parents 35a08b0 + 6033b56 commit e1d1a57

File tree

93 files changed

+5964
-1934
lines changed

Some content is hidden

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

93 files changed

+5964
-1934
lines changed

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<!-- Comment lines like this one will remain invisible -->
2+
3+
<!-- Thank you for your contribution! Please fill in this template so that we
4+
can understand your intent and the proposed changes. If anything about this
5+
template is unclear, just mention it! -->
6+
7+
**Summary**
8+
<!-- Summary of what & why - explain your motivation and/or link to any GitHub issues this relates to -->
9+
10+
**Proposed changes**
11+
<!-- Large PRs should ideally be preceded by a design discussion on a separate issue! -->
12+
13+
<!-- A clear and concise description of the contents of this pull request. -->
14+
* ...
15+
16+
**What alternatives have you considered?**
17+
<!-- A clear and concise description of any alternative solutions or features you've considered. -->
18+
19+
**Breaking changes**
20+
<!-- If this PR breaks backwards-compatibility, please start the PR title with `**BREAKING**`! -->
21+
<!-- In this section, describe any changes that are not backwards-compatible, -->
22+
<!-- why it is worth breaking backwards compatiblity, -->
23+
<!-- and how a user would have to address these changes in their downstream code. -->

.github/workflows/Cancel.yml

Lines changed: 0 additions & 21 deletions
This file was deleted.

.github/workflows/CompatHelper.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,24 +9,26 @@ jobs:
99
CompatHelper:
1010
runs-on: ubuntu-latest
1111
steps:
12+
- uses: actions/checkout@v2
1213
- name: "Install CompatHelper"
1314
run: |
1415
import Pkg
1516
name = "CompatHelper"
1617
uuid = "aa819f21-2bde-4658-8897-bab36330d9b7"
17-
version = "2"
18+
version = "3"
1819
Pkg.add(; name, uuid, version)
1920
shell: julia --color=yes {0}
2021
- name: "Run CompatHelper"
2122
run: |
2223
import CompatHelper
2324
subdirs = ["", "test", "docs"]
24-
for f in readdir(joinpath(@__DIR__, "examples"); join=true)
25+
for f in readdir("examples"; join=true)
2526
if isdir(f)
2627
push!(subdirs, joinpath("examples", basename(f)))
2728
end
2829
end
29-
CompatHelper.main(; subdirs=subdirs)
30+
@info "CompatHelper directories" subdirs
31+
CompatHelper.main(; subdirs=subdirs, bump_version=true)
3032
shell: julia --color=yes {0}
3133
env:
3234
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
# Credit to @aviastek, where this code comes from in JET.jl
2+
3+
# To workaroud https://github.com/actions/first-interaction/issues/10 in a secure way,
4+
# we take the following steps to generate and comment a performance benchmark result:
5+
# 1. first "performance tracking" workflow will generate the benchmark results in an unprivileged environment triggered on `pull_request` event
6+
# 2. then this "performance tracking (comment)" workflow will show the result to us as a PR comment in a privileged environment
7+
# Note that this workflow can only be modifed by getting checked-in to the default branch
8+
# and thus is secure even though this workflow is granted with write permissions, etc.
9+
# xref: https://securitylab.github.com/research/github-actions-preventing-pwn-requests/
10+
11+
name: Post Benchmark Comments
12+
13+
on:
14+
workflow_run:
15+
workflows:
16+
- performance tracking
17+
types:
18+
- completed
19+
20+
jobs:
21+
comment:
22+
runs-on: ubuntu-latest
23+
if: >
24+
${{ github.event.workflow_run.event == 'pull_request' &&
25+
github.event.workflow_run.conclusion == 'success' }}
26+
steps:
27+
- uses: actions/checkout@v2
28+
# restore records from the artifacts
29+
- uses: dawidd6/action-download-artifact@v2
30+
with:
31+
workflow: benchmark.yml
32+
name: Benchmarking
33+
workflow_conclusion: success
34+
- name: output benchmark result
35+
id: output-result-markdown
36+
run: |
37+
echo ::set-output name=body::$(cat ./benchmark-result.artifact)
38+
- name: output pull request number
39+
id: output-pull-request-number
40+
run: |
41+
echo ::set-output name=body::$(cat ./pull-request-number.artifact)
42+
# check if the previous comment exists
43+
- name: find comment
44+
uses: peter-evans/find-comment@v1
45+
id: fc
46+
with:
47+
issue-number: ${{ steps.output-pull-request-number.outputs.body }}
48+
comment-author: 'github-actions[bot]'
49+
body-includes: Kernel Benchmark Result
50+
# create/update comment
51+
- name: create comment
52+
if: ${{ steps.fc.outputs.comment-id == 0 }}
53+
uses: peter-evans/create-or-update-comment@v1
54+
with:
55+
issue-number: ${{ steps.output-pull-request-number.outputs.body }}
56+
body: ${{ steps.output-result-markdown.outputs.body }}
57+
- name: update comment
58+
if: ${{ steps.fc.outputs.comment-id != 0 }}
59+
uses: peter-evans/create-or-update-comment@v1
60+
with:
61+
comment-id: ${{ steps.fc.outputs.comment-id }}
62+
body: ${{ steps.output-result-markdown.outputs.body }}

.github/workflows/benchmark.yml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: Run benchmarks
2+
3+
on:
4+
pull_request:
5+
types: [opened, synchronize, reopened, labeled]
6+
7+
concurrency:
8+
# Skip intermediate builds: always.
9+
# Cancel intermediate builds: only if it is a pull request build.
10+
group: ${{ github.workflow }}-${{ github.ref }}
11+
cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }}
12+
13+
jobs:
14+
Benchmarking:
15+
runs-on: ubuntu-latest
16+
if: contains(github.event.pull_request.labels.*.name, 'performance critical')
17+
steps:
18+
# setup
19+
- uses: actions/checkout@v2
20+
- uses: julia-actions/setup-julia@latest
21+
with:
22+
version: '1.7'
23+
- uses: julia-actions/julia-buildpkg@latest
24+
- name: install dependencies
25+
run: julia -e 'using Pkg; pkg"add PkgBenchmark [email protected]"'
26+
# run the benchmark suite
27+
- name: run benchmarks
28+
run: |
29+
using BenchmarkCI
30+
BenchmarkCI.judge()
31+
BenchmarkCI.displayjudgement()
32+
shell: julia --color=yes {0}
33+
# generate and record the benchmark result as markdown
34+
- name: generate benchmark result
35+
run: |
36+
using BenchmarkCI
37+
judgement = BenchmarkCI._loadjudge(BenchmarkCI.DEFAULT_WORKSPACE)
38+
title = "Kernel Benchmark Result"
39+
ciresult = BenchmarkCI.CIResult(; judgement, title)
40+
comment = sprint() do io
41+
return BenchmarkCI.printcommentmd(io, ciresult)
42+
end
43+
comment = replace(comment, "%" => "%25", "\\n" => "%0A", "\\r" => "%0D")
44+
write("benchmark-result.artifact", comment)
45+
shell: julia --color=yes {0}
46+
# record the pull request number
47+
- name: record pull request number
48+
run: echo ${{ github.event.pull_request.number }} > ./pull-request-number.artifact
49+
# save as artifacts (performance tracking (comment) workflow will use it)
50+
- uses: actions/upload-artifact@v2
51+
with:
52+
name: Benchmarking
53+
path: ./*.artifact

.github/workflows/ci.yml

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,17 @@
11
name: CI
2+
23
on:
34
push:
45
branches:
56
- master
67
pull_request:
8+
9+
concurrency:
10+
# Skip intermediate builds: always.
11+
# Cancel intermediate builds: only if it is a pull request build.
12+
group: ${{ github.workflow }}-${{ github.ref }}
13+
cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }}
14+
715
jobs:
816
test:
917
name: Julia ${{ matrix.version }} - ${{ matrix.group }}
@@ -50,20 +58,8 @@ jobs:
5058
GROUP: ${{ matrix.group }}
5159
- uses: julia-actions/julia-processcoverage@v1
5260
if: matrix.version == '1' && matrix.os == 'ubuntu-latest'
53-
- name: Coveralls parallel
61+
- name: Send coverage to CodeCov
5462
if: matrix.version == '1' && matrix.os == 'ubuntu-latest'
55-
uses: coverallsapp/github-action@master
63+
uses: codecov/codecov-action@v2
5664
with:
57-
github-token: ${{ secrets.GITHUB_TOKEN }}
58-
path-to-lcov: ./lcov.info
59-
flag-name: run-${{ matrix.group }}
60-
parallel: true
61-
finish:
62-
needs: test
63-
runs-on: ubuntu-latest
64-
steps:
65-
- name: Send coverage
66-
uses: coverallsapp/github-action@master
67-
with:
68-
github-token: ${{ secrets.github_token }}
69-
parallel-finished: true
65+
file: lcov.info

.github/workflows/docs.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@ on:
77
tags: '*'
88
pull_request:
99

10+
concurrency:
11+
# Skip intermediate builds: always.
12+
# Cancel intermediate builds: only if it is a pull request build.
13+
group: ${{ github.workflow }}-${{ github.ref }}
14+
cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }}
15+
1016
jobs:
1117
build:
1218
runs-on: ubuntu-latest

.github/workflows/format.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@ name: Format suggestions
22

33
on:
44
pull_request:
5+
6+
concurrency:
7+
# Skip intermediate builds: always.
8+
# Cancel intermediate builds: only if it is a pull request build.
9+
group: ${{ github.workflow }}-${{ github.ref }}
10+
cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }}
511

612
jobs:
713
format:

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@
44
/test/Manifest.toml
55
coverage/
66
.DS_store
7+
benchmark/Manifest.toml

Project.toml

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name = "KernelFunctions"
22
uuid = "ec8451be-7e33-11e9-00cf-bbf324bd1392"
3-
version = "0.10.6"
3+
version = "0.10.33"
44

55
[deps]
66
ChainRulesCore = "d360d2e6-b24c-11e9-a2a3-2a2ae2dbcce4"
@@ -9,27 +9,29 @@ CompositionsBase = "a33af91c-f02d-484b-be07-31d278c5ca2b"
99
Distances = "b4f34e82-e78d-54a5-968a-f98e89d6e8f7"
1010
FillArrays = "1a297f60-69ca-5386-bcde-b61e274b549b"
1111
Functors = "d9f16b24-f501-4c13-a1f2-28368ffc5196"
12+
IrrationalConstants = "92d709cd-6900-40b7-9082-c6be49f344b6"
1213
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
14+
LogExpFunctions = "2ab3a3ac-af41-5b50-aa03-7779005ae688"
1315
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
1416
Requires = "ae029012-a4dd-5104-9daa-d747884805df"
1517
SpecialFunctions = "276daf66-3868-5448-9aa4-cd146d93841b"
1618
StatsBase = "2913bbd2-ae8a-5f71-8c99-4fb6c76f3a91"
17-
StatsFuns = "4c63d2b9-4356-54db-8cca-17b64c39e42c"
1819
TensorCore = "62fd8b95-f654-4bbd-a8a5-9c27f68ccd50"
1920
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
2021
ZygoteRules = "700de1a5-db45-46bc-99cf-38207098b444"
2122

2223
[compat]
23-
ChainRulesCore = "0.9.44, 0.10"
24+
ChainRulesCore = "1"
2425
Compat = "3.7"
2526
CompositionsBase = "0.1"
2627
Distances = "0.10"
27-
FillArrays = "0.10, 0.11"
28+
FillArrays = "0.10, 0.11, 0.12, 0.13"
2829
Functors = "0.1, 0.2"
30+
IrrationalConstants = "0.1"
31+
LogExpFunctions = "0.2.1, 0.3"
2932
Requires = "1.0.1"
30-
SpecialFunctions = "0.8, 0.9, 0.10, 1"
33+
SpecialFunctions = "0.8, 0.9, 0.10, 1, 2"
3134
StatsBase = "0.32, 0.33"
32-
StatsFuns = "0.8, 0.9"
3335
TensorCore = "0.1"
3436
ZygoteRules = "0.2"
3537
julia = "1.3"

README.md

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,22 @@
11
# KernelFunctions.jl
22

33
![CI](https://github.com/JuliaGaussianProcesses/KernelFunctions.jl/workflows/CI/badge.svg?branch=master)
4-
[![Coverage Status](https://coveralls.io/repos/github/JuliaGaussianProcesses/KernelFunctions.jl/badge.svg?branch=master)](https://coveralls.io/github/JuliaGaussianProcesses/KernelFunctions.jl?branch=master)
4+
[![codecov](https://codecov.io/gh/JuliaGaussianProcesses/KernelFunctions.jl/branch/master/graph/badge.svg?token=rmDh3gb7hN)](https://codecov.io/gh/JuliaGaussianProcesses/KernelFunctions.jl)
55
[![Documentation (stable)](https://img.shields.io/badge/docs-stable-blue.svg)](https://juliagaussianprocesses.github.io/KernelFunctions.jl/stable)
66
[![Documentation (latest)](https://img.shields.io/badge/docs-dev-blue.svg)](https://juliagaussianprocesses.github.io/KernelFunctions.jl/dev)
77
[![ColPrac: Contributor's Guide on Collaborative Practices for Community Packages](https://img.shields.io/badge/ColPrac-Contributor's%20Guide-blueviolet)](https://github.com/SciML/ColPrac)
88
[![Code Style: Blue](https://img.shields.io/badge/code%20style-blue-4495d1.svg)](https://github.com/invenia/BlueStyle)
9+
[![DOI](https://zenodo.org/badge/188430419.svg)](https://zenodo.org/badge/latestdoi/188430419)
10+
911

1012

1113
## Kernel functions for machine learning
1214

13-
KernelFunctions.jl provide a flexible and complete framework for kernel functions, pretransforming the input data.
15+
KernelFunctions.jl provides a flexible framework for defining kernel functions, and an extensive collection of implementations.
16+
17+
The aim is to make the API as model-agnostic as possible while still being user-friendly, and to interoperate well with generic packages for handling parameters like [ParameterHandling.jl](https://github.com/invenia/ParameterHandling.jl/) and FluxML's [Functors.jl](https://github.com/FluxML/Functors.jl/).
1418

15-
The aim is to make the API as model-agnostic as possible while still being user-friendly.
19+
Where appropriate, kernels are AD-compatible.
1620

1721
## Examples
1822

@@ -44,12 +48,12 @@ plot(
4448
<img src="docs/src/assets/heatmap_combination.png" width=400px>
4549
</p>
4650

47-
## Packages goals (by priority)
48-
- Ensure AD Compatibility (already the case for Zygote, ForwardDiff)
49-
- Toeplitz Matrices compatibility
51+
## Related Work
5052

5153
Directly inspired by the [MLKernels](https://github.com/trthatcher/MLKernels.jl) package.
5254

55+
See the JuliaGaussianProcesses [Github organisation](https://github.com/JuliaGaussianProcesses) and [website](https://juliagaussianprocesses.github.io/) for more related packages.
56+
5357
## Issues/Contributing
5458

5559
If you notice a problem or would like to contribute by adding more kernel functions or features please [submit an issue](https://github.com/JuliaGaussianProcesses/KernelFunctions.jl/issues), or open a PR (please see the [ColPrac](https://github.com/SciML/ColPrac) contribution guidelines).

benchmark/MLKernels.jl

Lines changed: 0 additions & 22 deletions
This file was deleted.

benchmark/Project.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[deps]
2+
BenchmarkTools = "6e4b80f9-dd63-53aa-95a3-0cdb28fa8baf"
3+
KernelFunctions = "ec8451be-7e33-11e9-00cf-bbf324bd1392"

0 commit comments

Comments
 (0)