Skip to content

Commit

Permalink
bundle updates: add build step for conda R packages & mv competitors …
Browse files Browse the repository at this point in the history
…to paper repo (https://github.com/szcf-weiya/paper_Monotone-Cubic-B-Splines) & rm unused functions
  • Loading branch information
szcf-weiya committed Nov 20, 2023
1 parent e6a2d6f commit b259b18
Show file tree
Hide file tree
Showing 10 changed files with 48 additions and 197 deletions.
3 changes: 0 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,7 @@ jobs:
options(repos=r)
install.packages("fda")
install.packages("lsei")
install.packages("Iso")
install.packages("cobs")
install.packages("splines")
install.packages("monmlp")
shell: sudo Rscript {0}

- uses: julia-actions/setup-julia@latest
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ Manifest.toml
*.sil
*.png
docs/build
docs/src/examples
docs/src/examples
*.log
4 changes: 3 additions & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
name = "MonotoneSplines"
uuid = "92812004-5f8d-4354-96af-0c8b7c0637d0"
authors = ["szcf-weiya <[email protected]>"]
version = "0.1.0"
version = "0.1.1"

[deps]
BSON = "fbb218c0-5317-5bc6-957e-2ee96dd4b1f0"
Conda = "8f4d0f93-b110-5947-807f-2305c1781a2d"
ECOS = "e2685f51-7e38-5353-a97d-a921fd2c8199"
Flux = "587475ba-b771-5e3f-ad9e-33799f191a9c"
JuMP = "4076af6c-e467-56ae-b986-b466b2749572"
Expand All @@ -19,6 +20,7 @@ Zygote = "e88e6eb3-aa80-5325-afca-941959d7151f"

[compat]
BSON = "0.3"
Conda = "1.4"
ECOS = "1.1"
Flux = "0.13"
JuMP = "1.3"
Expand Down
24 changes: 14 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,20 @@

Check the following paper for more details.

> Wang, L., Fan, X., Li, H., & Liu, J. S. (2023). Monotone Cubic B-Splines (arXiv:2307.01748). arXiv. https://doi.org/10.48550/arXiv.2307.01748
> Wang, Lijun, Xiaodan Fan, Huabai Li, and Jun S. Liu. “Monotone Cubic B-Splines with a Neural-Network Generator.” arXiv, November 17, 2023. https://doi.org/10.48550/arXiv.2307.01748.
```
@misc{wang2023monotone,
title={Monotone Cubic B-Splines},
author={Lijun Wang and Xiaodan Fan and Huabai Li and Jun S. Liu},
year={2023},
eprint={2307.01748},
archivePrefix={arXiv},
primaryClass={stat.ME}
@online{wangMonotoneCubicBSplines2023c,
title = {Monotone {{Cubic B-Splines}} with a {{Neural-Network Generator}}},
author = {Wang, Lijun and Fan, Xiaodan and Li, Huabai and Liu, Jun S.},
date = {2023-11-17},
eprint = {2307.01748},
eprinttype = {arxiv},
eprintclass = {astro-ph, stat},
doi = {10.48550/arXiv.2307.01748},
url = {http://arxiv.org/abs/2307.01748},
urldate = {2023-11-20},
pubstate = {preprint}
}
```

Expand All @@ -41,8 +45,6 @@ julia> ]
(@v1.8) pkg> add MonotoneSplines
```



By default, both `PyCall.jl` and `RCall.jl` would try to use the system Python and R, respectively (more details can be found in their repos).

### :ladder: standalone R and Python via Conda.jl
Expand All @@ -56,6 +58,8 @@ julia> ]
(@v1.8) pkg> add MonotoneSplines
```

If you use the standalone R provided by Conda in Julia, the dependent R packages will be automatically installed during the building step.

## :books: Documentation

The documentation <https://hohoweiya.xyz/MonotoneSplines.jl/stable/> elaborates on the usage of the package via various simulation examples and an interesting astrophysics application.
27 changes: 27 additions & 0 deletions deps/build.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
Rhome = get(ENV, "R_HOME", "")
if Rhome == "*"
try
import Conda
# If using Conda's R, install R package automatically.
Conda.add("r-fda")
Conda.add("r-splines")
Conda.add("r-lsei")
@info "R packages are installed successfully."
catch e
@warn """
Fail to automatically install dependent R packages in Conda due to $e.
Please fix the error message first and then reinstall via
```julia
Conda.add("r-fda")
Conda.add("r-splines")
Conda.add("r-lsei")
```
Alternatively, you can consider using system R, and install the packages via the standard way `install.packages(..)`
"""
end
else
@info "You are not using Conda's R, please install R packages by yourself."
end
19 changes: 0 additions & 19 deletions scripts/demo_ci.jl

This file was deleted.

140 changes: 0 additions & 140 deletions scripts/experiments.jl

This file was deleted.

12 changes: 2 additions & 10 deletions src/MonotoneSplines.jl
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,8 @@ _runtime_init() = @eval begin
copy!(_py_boot, PyCall.pyimport("boot"))
end

function __init__()
nothing
end

export check_CI,
check_acc,
cubic,
logit,
logit5,
sinhalfpi,
export check_CI,
check_acc,
smooth_spline,
mono_cs,
mono_ss,
Expand Down
6 changes: 0 additions & 6 deletions src/boot.jl
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,6 @@ using BSON
using Zygote
using ProgressMeter

## determine functions formally (NB: Be better not to change the name)
cubic(x) = x^3
logit(x) = 1/(1+exp(-x))
logit5(x) = 1/(1+exp(-5x))
sinhalfpi(x) = sin(pi/2 * x)

"""
check_CI(; <keyword arguments>)
Expand Down
7 changes: 0 additions & 7 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -101,13 +101,6 @@ end
@test MonotoneSplines.conf_band_width([0 1; 0 3]) 2.0
end

@testset "example functions" begin
@test isa(cubic, Function)
@test isa(logit, Function)
@test isa(logit5, Function)
@test isa(sinhalfpi, Function)
end

R"""
recover.Sigma <- function(Sigma) {
n = length(Sigma)
Expand Down

2 comments on commit b259b18

@szcf-weiya
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/95666

Tip: Release Notes

Did you know you can add release notes too? Just add markdown formatted text underneath the comment after the text
"Release notes:" and it will be added to the registry PR, and if TagBot is installed it will also be added to the
release that TagBot creates. i.e.

@JuliaRegistrator register

Release notes:

## Breaking changes

- blah

To add them here just re-invoke and the PR will be updated.

Tagging

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.1.1 -m "<description of version>" b259b1878a457094b2ccb0308d74bddf94f82073
git push origin v0.1.1

Please sign in to comment.