Skip to content

Commit

Permalink
Merge pull request #40 from JuliaStats/aa/housekeeping
Browse files Browse the repository at this point in the history
Miscellaneous housekeeping items
  • Loading branch information
ararslan authored Jul 9, 2022
2 parents 755433a + 84e2964 commit 34b815f
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 33 deletions.
27 changes: 6 additions & 21 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
name: CI
on:
pull_request:
branches:
- master
push:
branches:
- master
tags: '*'
branches: [master]
tags: ["*"]
pull_request:
jobs:
test:
name: Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }} - ${{ github.event_name }}
Expand All @@ -15,7 +12,7 @@ jobs:
fail-fast: false
matrix:
version:
- '1.2'
- '1.6'
- '1'
- 'nightly'
os:
Expand Down Expand Up @@ -49,20 +46,8 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: julia-actions/setup-julia@v1
with:
version: '1'
- run: |
julia --project=docs -e '
using Pkg
Pkg.develop(PackageSpec(path=pwd()))
Pkg.instantiate()'
- run: |
julia --project=docs -e '
using Documenter: doctest
using Survival
doctest(Survival)'
- run: julia --project=docs docs/make.jl
- uses: julia-actions/julia-buildpkg@latest
- uses: julia-actions/julia-docdeploy@latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
DOCUMENTER_KEY: ${{ secrets.DOCUMENTER_KEY }}
8 changes: 4 additions & 4 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,22 @@ uuid = "8a913413-2070-5976-9d4c-2b364fdc2f7f"
version = "0.2.2"

[deps]
Compat = "34da2185-b29b-5c13-b0c7-acf172513d20"
Distributions = "31c24e10-a181-5473-b8eb-7969acd0382f"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
Optim = "429524aa-4258-5aef-a3af-852621145aeb"
PositiveFactorizations = "85a6dd25-e78a-55b7-8502-1745935b8125"
StatsBase = "2913bbd2-ae8a-5f71-8c99-4fb6c76f3a91"
StatsModels = "3eaba693-59b7-5ba5-a881-562e759f1c8d"

[compat]
CategoricalArrays = "0.9"
CategoricalArrays = "0.9, 0.10"
Compat = "3.43, 4"
DataFrames = "1"
Distributions = "0.20, 0.21, 0.22, 0.23, 0.24, 0.25"
Optim = "1"
PositiveFactorizations = "0.2"
StatsBase = "0.30, 0.31, 0.32, 0.33"
StatsModels = "0.6"
julia = "1.2"
julia = "1.6"

[extras]
CSV = "336ed68f-0bac-5ca0-87d4-7b16caf5d00b"
Expand Down
4 changes: 2 additions & 2 deletions src/Survival.jl
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
module Survival

using Compat
using Distributions
using LinearAlgebra
using PositiveFactorizations
using Optim
using StatsBase
using StatsModels
using Optim

export
EventTime,
Expand Down
10 changes: 4 additions & 6 deletions src/cox.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Some utility functions to compute Cox regression

promote_nonmissing(::Type{T}) where {T} = Base.promote_op(/, T, T)
promote_nonmissing(::Type{T}) where {T} = typeof(one(T) / one(T))
promote_nonmissing(::Type{Union{T,Missing}}) where {T} = promote_nonmissing(T)

struct CoxSum{T,N}
Expand Down Expand Up @@ -130,10 +130,8 @@ end

function _cox_fgh!(β, grad, hes, c::CoxAux{T}) where T
update_cox!(c, β, (hes !== nothing) | (grad !== nothing))
X, ξ, Xβ, θ, Xθ, ξθ, λ, fs, ls =
c.X, c.ξ, c.Xβ, c.θ, c.Xθ, c.ξθ, c.λ, c.fs, c.ls
R = Base.promote_op(/, T, T)
y = zero(R)
@compat (; X, ξ, Xβ, θ, Xθ, ξθ, λ, fs, ls) = c
y = zero(T) / one(T)

if hes !== nothing
fill!(hes, 0)
Expand All @@ -143,7 +141,7 @@ function _cox_fgh!(β, grad, hes, c::CoxAux{T}) where T
end
if grad !== nothing || hes !== nothing
# preallocate
Z = zeros(R, length(β))
Z = zeros(typeof(y), length(β))
end

@inbounds for i in 1:length(fs)
Expand Down

0 comments on commit 34b815f

Please sign in to comment.