Skip to content

Commit

Permalink
Bump minimum Julia version to 0.6 (#22)
Browse files Browse the repository at this point in the history
  • Loading branch information
ararslan committed Oct 2, 2017
1 parent 6a5522c commit 5893193
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 30 deletions.
17 changes: 9 additions & 8 deletions .travis.yml
@@ -1,16 +1,17 @@
language: julia
os:
- linux
addons:
apt:
packages:
- gfortran
julia:
- 0.4
- 0.5
- 0.6
- nightly
notifications:
email: false
before_install:
- sudo apt-get install gfortran -y
script:
- if [[ -a .git/shallow ]]; then git fetch --unshallow; fi
- julia --check-bounds=yes -e 'Pkg.clone(pwd()); Pkg.build("GLMNet"); Pkg.test("GLMNet"; coverage=true)'
#script:
# - if [[ -a .git/shallow ]]; then git fetch --unshallow; fi
# - julia --check-bounds=yes -e 'Pkg.clone(pwd()); Pkg.build("GLMNet"); Pkg.test("GLMNet"; coverage=true)'
after_success:
- if [ $TRAVIS_JULIA_VERSION = "nightly" ]; then julia -e 'cd(Pkg.dir("GLMNet")); Pkg.add("Coverage"); using Coverage; Coveralls.submit(Coveralls.process_folder())'; fi
- julia -e 'cd(Pkg.dir("GLMNet")); Pkg.add("Coverage"); using Coverage; Coveralls.submit(Coveralls.process_folder())'
12 changes: 6 additions & 6 deletions README.md
@@ -1,7 +1,7 @@
# GLMNet

[![Build Status](https://travis-ci.org/simonster/GLMNet.jl.svg?branch=master)](https://travis-ci.org/simonster/GLMNet.jl)
[![Coverage Status](https://coveralls.io/repos/simonster/GLMNet.jl/badge.svg?branch=master)](https://coveralls.io/r/simonster/GLMNet.jl?branch=master)
[![Build Status](https://travis-ci.org/JuliaStats/GLMNet.jl.svg?branch=v0.0.4)](https://travis-ci.org/JuliaStats/GLMNet.jl)
[![Coverage Status](https://coveralls.io/repos/github/JuliaStats/GLMNet.jl/badge.svg)](https://coveralls.io/github/JuliaStats/GLMNet.jl)

[glmnet](http://www.jstatsoft.org/v33/i01/) is an R package by Jerome Friedman, Trevor Hastie, Rob Tibshirani that fits entire Lasso or ElasticNet regularization paths for linear, logistic, multinomial, and Cox models using cyclic coordinate descent. This Julia package wraps the Fortran code from glmnet.

Expand Down Expand Up @@ -34,9 +34,9 @@ Least Squares GLMNet Solution Path (55 solutions for 4 predictors in 163 passes)
```julia
julia> path.betas
4x55 CompressedPredictorMatrix:
0.0 0.083706 0.159976 0.22947 0.929157 0.929315
0.0 0.083706 0.159976 0.22947 0.929157 0.929315
0.0 0.0 0.0 0.0 0.00655753 0.00700862
0.0 0.0 0.0 0.0 0.0 0.0
0.0 0.0 0.0 0.0 0.0 0.0
0.0 0.0 0.0 0.0 0.0 0.0
```

Expand All @@ -63,9 +63,9 @@ julia> indmin(cv.meanloss)

julia> cv.path.betas[:, 48]
4-element Array{Float64,1}:
0.926911
0.926911
0.00366805
0.0
0.0
0.0
```

Expand Down
2 changes: 1 addition & 1 deletion REQUIRE
@@ -1,4 +1,4 @@
julia 0.4
julia 0.6
Distributions
StatsBase
Compat 0.9.3
2 changes: 1 addition & 1 deletion deps/build.jl
@@ -1,5 +1,5 @@
using Compat
@static if is_windows()
if Compat.Sys.iswindows()
flags = ["-m$(Sys.WORD_SIZE)","-fdefault-real-8","-ffixed-form","-shared","-O3"]
else
flags = ["-m$(Sys.WORD_SIZE)","-fdefault-real-8","-ffixed-form","-shared","-O3","-fPIC"]
Expand Down
24 changes: 10 additions & 14 deletions src/GLMNet.jl
@@ -1,3 +1,5 @@
__precompile__()

module GLMNet
using Distributions, Compat, StatsBase

Expand Down Expand Up @@ -47,21 +49,15 @@ function getindex(X::CompressedPredictorMatrix, a::AbstractVector{Int}, b::Abstr
end


if VERSION < v"0.5.0"
# use old slicing behaviour
getindex(X::CompressedPredictorMatrix, a::Int, b::AbstractVector{Int}) = getindex(X,[a],b)
else
# use new slicing behaviour
function getindex(X::CompressedPredictorMatrix, a::Int, b::AbstractVector{Int})
checkbounds(X, a, b)
out = zeros(length(b))
for j = 1:length(b), i = 1:X.nin[b[j]]
if a == X.ia[i]
out[j] = X.ca[i, b[j]]
end
function getindex(X::CompressedPredictorMatrix, a::Int, b::AbstractVector{Int})
checkbounds(X, a, b)
out = zeros(length(b))
for j = 1:length(b), i = 1:X.nin[b[j]]
if a == X.ia[i]
out[j] = X.ca[i, b[j]]
end
out
end
out
end

# Get number of active predictors for a model in X
Expand All @@ -76,7 +72,7 @@ end
nactive(X::CompressedPredictorMatrix, b::AbstractVector{Int}=1:length(X.nin)) =
[nactive(X, j) for j in b]

function convert{T<:Matrix{Float64}}(::Type{T}, X::CompressedPredictorMatrix)
function convert(::Type{Matrix{Float64}}, X::CompressedPredictorMatrix)
mat = zeros(X.ni, length(X.nin))
for b = 1:size(mat, 2), i = 1:X.nin[b]
mat[X.ia[i], b] = X.ca[i, b]
Expand Down

0 comments on commit 5893193

Please sign in to comment.