Skip to content

Commit

Permalink
improve docs & add documenter key (szcf-weiya/Clouds#31)
Browse files Browse the repository at this point in the history
  • Loading branch information
szcf-weiya committed Jan 12, 2024
1 parent c0f1a64 commit 81358d1
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 13 deletions.
10 changes: 1 addition & 9 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,10 @@ jobs:
r["CRAN"] = "https://cloud.r-project.org/"
options(repos=r)
options(download.file.method = "wget")
install.packages("remotes")
install.packages("RCurl", INSTALL_opts = "--no-test-load") # required by fda
install.packages("fda")
install.packages("lsei")
install.packages("Iso")
install.packages("cobs")
install.packages("splines")
install.packages("monmlp")
shell: Rscript {0}
env:
MAKEFLAGS: LDFLAGS=-Wl,-rpath,/opt/hostedtoolcache/julia/${{ matrix.julia-version }}/x64/bin/../lib/julia/\ -L/opt/hostedtoolcache/julia/${{ matrix.julia-version }}/x64/bin/../lib/julia/
Expand Down Expand Up @@ -87,14 +83,10 @@ jobs:
r["CRAN"] = "https://cloud.r-project.org/"
options(repos=r)
options(download.file.method = "wget")
install.packages("remotes")
install.packages("RCurl", INSTALL_opts = "--no-test-load") # required by fda
install.packages("fda")
install.packages("lsei")
install.packages("Iso")
install.packages("cobs")
install.packages("splines")
install.packages("monmlp")
shell: Rscript {0}
env:
MAKEFLAGS: LDFLAGS=-Wl,-rpath,/opt/hostedtoolcache/julia/${{ matrix.julia-version }}/x64/bin/../lib/julia/\ -L/opt/hostedtoolcache/julia/${{ matrix.julia-version }}/x64/bin/../lib/julia/
Expand All @@ -105,5 +97,5 @@ jobs:
env:
LD_LIBRARY_PATH: /opt/R/${{ matrix.r-version }}/lib/R/lib
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # If authenticating with GitHub Actions token
# DOCUMENTER_KEY: ${{ secrets.DOCUMENTER_KEY }} # If authenticating with SSH deploy key
DOCUMENTER_KEY: ${{ secrets.DOCUMENTER_KEY }} # If authenticating with SSH deploy key

2 changes: 2 additions & 0 deletions docs/Project.toml
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
[deps]
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
LaTeXStrings = "b964fa9f-0449-5b57-a5c2-d3ea65f4040f"
Literate = "98b081ad-f1c9-55d3-8b20-4c87d4299306"
Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80"
RCall = "6f49c342-dc21-5d91-9882-a32aef131414"

[compat]
Documenter = "0.27"
LaTeXStrings = "1.3"
Literate = "2.14"
Plots = "1.35"
RCall = "0.13"
29 changes: 25 additions & 4 deletions src/mono_decomp.jl
Original file line number Diff line number Diff line change
Expand Up @@ -545,11 +545,19 @@ function cv_mono_decomp_ss(x::AbstractVector{T}, y::AbstractVector{T}; figname =
end

"""
benchmarking_cs(n, σ, f)
benchmarking_ss(n, σ, f)
benchmarking(f)
benchmarking_cs(n, σ, f; figname_cv = nothing, figname_fit = nothing)
Run benchmarking experiments for decomposition with cubic splines on `n` observations sampled from curve `f` with noise `σ`.
## Optional Arguments
Run benchmarking experiments on `n` observations sampled from curve `f` with noise `σ`.
- `figname_cv`: if not `nothing`, the cross-validation error will be plotted and saved to the given path.
- `figname_fit`: if not `nothing`, the fitted curves will be plotted and saved to the given path.
- `Js`: the candidates of number of basis functions.
- `fixJ`: whether to use the CV-tuned `J` from the crossponding cubic spline fitting.
- `nfold`: the number of folds in cross-validation procedure
- `one_se_rule`: whether to use the one-standard-error rule to select the parameter after cross-validation procedure
- `μs`: the candidates of tuning parameters for the discrepancy parameter
"""
function benchmarking_cs(n::Int = 100, σ::Float64 = 0.5, f::Union{Function, String} = x->x^3; fixJ = true,
figname_cv = nothing,
Expand Down Expand Up @@ -577,6 +585,11 @@ function benchmarking_cs(n::Int = 100, σ::Float64 = 0.5, f::Union{Function, Str
return err
end

"""
benchmarking_ss(n, σ, f)
Run benchmarking experiments for decomposition with smoothing splines on `n` observations sampled from curve `f` with noise `σ`.
"""
function benchmarking_ss(n::Int = 100, σ::Float64 = 0.5,
f::Union{Function, String} = x->x^3;
nfold = 5, one_se_rule = true,
Expand All @@ -603,6 +616,14 @@ function benchmarking_ss(n::Int = 100, σ::Float64 = 0.5,
return err
end

"""
benchmarking(f::String)
Run benchmarking experiments for monotone decomposition on curve `f`. The candidates of `f` include:
- simple functions: `x^2`, `x^3`, `exp(x)`, `sigmoid`
- random functions generated from Gaussian Process: "SE_1" "SE_0.1" "Mat12_1" "Mat12_0.1" "Mat32_1" "Mat32_0.1" "RQ_0.1_0.5" "Periodic_0.1_4"
"""
function benchmarking(f::String = "x^3"; n = 100, σs = 0.2:0.2:1,
J = 10,
μs = 10.0 .^ (-6:0.5:0), ## bspl
Expand Down

0 comments on commit 81358d1

Please sign in to comment.