Skip to content

Commit c2cb3f2

Browse files
alexmorleyararslan
authored andcommitted
Fixed a whole bunch of dep warnings (#37)
1 parent b535ee2 commit c2cb3f2

File tree

14 files changed

+53
-58
lines changed

14 files changed

+53
-58
lines changed

.travis.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@ os:
33
- linux
44
- osx
55
julia:
6-
- 0.4
7-
- 0.5
6+
- 0.6
87
- nightly
98
notifications:
109
email: false

README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33
Swiss knife for machine learning.
44

55
[![Build Status](https://travis-ci.org/JuliaStats/MLBase.jl.svg?branch=master)](https://travis-ci.org/JuliaStats/MLBase.jl)
6-
[![MLBase](http://pkg.julialang.org/badges/MLBase_0.4.svg)](http://pkg.julialang.org/?pkg=MLBase)
7-
[![MLBase](http://pkg.julialang.org/badges/MLBase_0.5.svg)](http://pkg.julialang.org/?pkg=MLBase)
6+
[![MLBase](http://pkg.julialang.org/badges/MLBase_0.6.svg)](http://pkg.julialang.org/?pkg=MLBase)
87
[![Coveralls](https://coveralls.io/repos/github/JuliaStats/MLBase.jl/badge.svg?branch=master)](https://coveralls.io/github/JuliaStats/MLBase.jl?branch=master)
98

109
This package does not implement specific machine learning algorithms. Instead, it provides a collection of useful tools to support machine learning programs, including:

REQUIRE

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
julia 0.4
1+
julia 0.6
22
Reexport
33
StatsBase 0.6.9-
4-
Iterators
5-
Compat 0.8.7
4+
IterTools

src/MLBase.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
module MLBase
22

33
using Reexport
4-
using Iterators
4+
using IterTools
55
using Compat
66
using Compat: view
77
@reexport using StatsBase

src/classification.jl

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ end
3232

3333
classify!(r::IntegerVector, x::RealMatrix) = classify!(r, x, Forward)
3434

35-
classify(x::RealMatrix, ord::Ordering) = classify!(Array(Int, size(x,2)), x, ord)
35+
classify(x::RealMatrix, ord::Ordering) = classify!(Array{Int}(size(x,2)), x, ord)
3636
classify(x::RealMatrix) = classify(x, Forward)
3737

3838
# classify with score(s)
@@ -70,8 +70,8 @@ classify_withscores!(r::IntegerVector, s::RealVector, x::RealMatrix) =
7070

7171
function classify_withscores{T<:Real}(x::RealMatrix{T}, ord::Ordering)
7272
n = size(x, 2)
73-
r = Array(Int, n)
74-
s = Array(T, n)
73+
r = Array{Int}(n)
74+
s = Array{T}(n)
7575
return classify_withscores!(r, s, x, ord)
7676
end
7777

@@ -97,7 +97,7 @@ end
9797

9898
classify!(r::IntegerVector, x::RealMatrix, t::Real) = classify!(r, x, t, Forward)
9999

100-
classify(x::RealMatrix, t::Real, ord::Ordering) = classify!(Array(Int, size(x,2)), x, t, ord)
100+
classify(x::RealMatrix, t::Real, ord::Ordering) = classify!(Array{Int}(size(x,2)), x, t, ord)
101101
classify(x::RealMatrix, t::Real) = classify(x, t, Forward)
102102

103103

@@ -107,13 +107,13 @@ immutable LabelMap{K}
107107
vs::Vector{K}
108108
v2i::Dict{K,Int}
109109

110-
function LabelMap(vs, v2i)
110+
function LabelMap{K}(vs, v2i) where K
111111
length(vs) == length(v2i) || throw(DimensionMismatch("lengths of vs and v2i mismatch"))
112-
new(vs, v2i)
112+
new(vs,v2i)
113113
end
114114
end
115115

116-
LabelMap{K}(vs::Vector{K}, v2i::Dict{K,Int}) = LabelMap{K}(vs, v2i)
116+
LabelMap{K}(vs::Vector{K}, v2i::Dict{K,Int})= LabelMap{K}(vs, v2i)
117117

118118
length(lmap::LabelMap) = length(lmap.vs)
119119
keys(lmap::LabelMap) = lmap.vs
@@ -154,7 +154,7 @@ labeldecode{T}(lmap::LabelMap{T}, ys::AbstractArray{Int}) =
154154
## group labels
155155

156156
function groupindices(k::Int, xs::IntegerVector; warning::Bool=true)
157-
gs = Array(Vector{Int}, k)
157+
gs = Array{Vector{Int}}(k)
158158
for i = 1:k
159159
gs[i] = Int[]
160160
end
@@ -176,7 +176,7 @@ end
176176

177177
function groupindices{T}(lmap::LabelMap{T}, xs::AbstractArray{T})
178178
k = length(lmap)
179-
gs = Array(Vector{Int}, k)
179+
gs = Array{Vector{Int}}(k)
180180
for i = 1:k
181181
gs[i] = Int[]
182182
end

src/crossval.jl

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
## cross validation generators
44

5-
abstract CrossValGenerator
5+
abstract type CrossValGenerator end
66

77
# K-fold
88

@@ -25,9 +25,9 @@ immutable KfoldState
2525
e::Int # ending index
2626
end
2727

28-
start(c::Kfold) = KfoldState(1, 1, @compat(round(Integer,c.coeff)))
28+
start(c::Kfold) = KfoldState(1, 1, round.(Integer,c.coeff))
2929
next(c::Kfold, s::KfoldState) =
30-
(i = s.i+1; (setdiff(1:length(c.permseq), c.permseq[s.s:s.e]), KfoldState(i, s.e+1, @compat(round(Integer,c.coeff * i)))))
30+
(i = s.i+1; (setdiff(1:length(c.permseq), c.permseq[s.s:s.e]), KfoldState(i, s.e+1, round.(Integer,c.coeff * i))))
3131
done(c::Kfold, s::KfoldState) = (s.i > c.k)
3232

3333
# Stratified K-fold
@@ -56,7 +56,7 @@ start(c::StratifiedKfold) = 1
5656
function next(c::StratifiedKfold, s::Int)
5757
r = Int[]
5858
for (permseq, coeff) in zip(c.permseqs, c.coeffs)
59-
a, b = @compat(round(Integer, [s-1, s] .* coeff))
59+
a, b = round.(Integer, [s-1, s] .* coeff)
6060
append!(r, view(permseq, a+1:b))
6161
end
6262
setdiff(1:c.n, r), s+1
@@ -67,7 +67,7 @@ done(c::StratifiedKfold, s::Int) = (s > c.k)
6767

6868
function leave_one_out(n::Int, i::Int)
6969
@assert 1 <= i <= n
70-
x = Array(Int, n-1)
70+
x = Array{Int}(n-1)
7171
for j = 1:i-1
7272
x[j] = j
7373
end
@@ -122,7 +122,7 @@ immutable StratifiedRandomSub <: CrossValGenerator
122122
for stratum_num in lengths_ord
123123
stratum_n = length(idxs[stratum_num])
124124
remaining_proportion = remaining_sn/remaining_n
125-
stratum_sn = max(@compat(round(Integer, remaining_proportion*stratum_n)), 1)
125+
stratum_sn = max(round.(Integer, remaining_proportion*stratum_n), 1)
126126
remaining_n -= stratum_n
127127
remaining_sn -= stratum_sn
128128
sns[stratum_num] = stratum_sn
@@ -136,7 +136,7 @@ length(c::StratifiedRandomSub) = c.k
136136

137137
start(c::StratifiedRandomSub) = 1
138138
function next(c::StratifiedRandomSub, s::Int)
139-
idxs = Array(Int, 0)
139+
idxs = Array{Int}(0)
140140
sizehint!(idxs, c.sn)
141141
for (stratum_sn, stratum_idxs) in zip(c.sns, c.idxs)
142142
append!(idxs, sample(stratum_idxs, stratum_sn, replace=false))

src/deprecated/datapre.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -104,17 +104,17 @@ end
104104
transform!{T<:AbstractFloat}(t::Standardize, x::DenseArray{T,1}) = transform!(x, t, x)
105105
transform!{T<:AbstractFloat}(t::Standardize, x::DenseArray{T,2}) = transform!(x, t, x)
106106

107-
transform{T<:Real}(t::Standardize, x::DenseArray{T,1}) = transform!(Array(Float64, size(x)), t, x)
108-
transform{T<:Real}(t::Standardize, x::DenseArray{T,2}) = transform!(Array(Float64, size(x)), t, x)
107+
transform{T<:Real}(t::Standardize, x::DenseArray{T,1}) = transform!(Array{Float64}(size(x)), t, x)
108+
transform{T<:Real}(t::Standardize, x::DenseArray{T,2}) = transform!(Array{Float64}(size(x)), t, x)
109109

110110
# estimate a standardize transform
111111

112112
function estimate{T<:Real}(::Type{Standardize}, X::DenseArray{T,2}; center::Bool=true, scale::Bool=true)
113113
d, n = size(X)
114114
n >= 2 || error("X must contain at least two columns.")
115115

116-
m = Array(Float64, ifelse(center, d, 0))
117-
s = Array(Float64, ifelse(scale, d, 0))
116+
m = Array{Float64}(ifelse(center, d, 0))
117+
s = Array{Float64}(ifelse(scale, d, 0))
118118

119119
if center
120120
fill!(m, 0.0)

src/modeltune.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ _always_true(xs...) = true
44

55
function gridtune(estfun::Function, # model estimation function
66
evalfun::Function, # model evaluation function
7-
params::@compat(Tuple{AbstractString, Any})...; # parameters to tune
7+
params::Tuple{AbstractString, Any}...; # parameters to tune
88
ord::Ordering=Forward, # ordering of score
99
verbose::Bool=false) # whether to display the progress
1010

src/perfeval.jl

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ end
2424
function counthits(gt::IntegerVector, rklst::IntegerMatrix, k::Integer)
2525
n = length(gt)
2626
size(rklst, 2) == n || throw(DimensionMismatch("Input dimensions mismatch."))
27-
m = min(size(rklst, 1), @compat(Int(k)))
27+
m = min(size(rklst, 1), Int(k))
2828

2929
cnt = 0
3030
@inbounds for j = 1:n
@@ -74,7 +74,7 @@ function hitrates(gt::IntegerVector, rklst::IntegerMatrix, ks::IntegerVector)
7474
n = length(gt)
7575
h = counthits(gt, rklst, ks)
7676
nk = length(ks)
77-
r = Array(Float64, nk)
77+
r = Array{Float64}(nk)
7878
for i = 1:nk
7979
r[i] = h[i] / n
8080
end
@@ -211,10 +211,10 @@ length(v::ThresPredVec) = length(v.preds)
211211
getindex(v::ThresPredVec, i::Integer) = ifelse(lt(v.ord, v.scores[i], v.thres), 0, v.preds[i])
212212

213213
# compute roc numbers based on predictions & scores & threshold
214-
roc{PV<:IntegerVector,SV<:RealVector}(gt::IntegerVector, preds::@compat(Tuple{PV,SV}), t::Real, ord::Ordering) =
214+
roc{PV<:IntegerVector,SV<:RealVector}(gt::IntegerVector, preds::Tuple{PV,SV}, t::Real, ord::Ordering) =
215215
_roc(gt, ThresPredVec(preds..., t, ord))
216216

217-
roc{PV<:IntegerVector,SV<:RealVector}(gt::IntegerVector, preds::@compat(Tuple{PV,SV}), thres::Real) =
217+
roc{PV<:IntegerVector,SV<:RealVector}(gt::IntegerVector, preds::Tuple{PV,SV}, thres::Real) =
218218
roc(gt, preds, thres, Forward)
219219

220220

@@ -278,7 +278,7 @@ function roc(gt::IntegerVector, scores::RealVector, thresholds::RealVector, ord:
278278
end
279279

280280
# produce results
281-
r = Array(ROCNums{Int}, nt)
281+
r = Array{ROCNums{Int}}(nt)
282282
fn = 0
283283
tn = 0
284284
@inbounds for i = 1:nt
@@ -303,7 +303,7 @@ roc(gt::IntegerVector, scores::RealVector) = roc(gt, scores, Forward)
303303

304304
# roc for multi-way predictions
305305
function roc{PV<:IntegerVector,SV<:RealVector}(
306-
gt::IntegerVector, preds::@compat(Tuple{PV,SV}), thresholds::RealVector, ord::Ordering)
306+
gt::IntegerVector, preds::Tuple{PV,SV}, thresholds::RealVector, ord::Ordering)
307307

308308
issorted(thresholds, ord) || error("thresholds must be sorted w.r.t. the given ordering.")
309309
pr::PV = preds[1]
@@ -341,7 +341,7 @@ function roc{PV<:IntegerVector,SV<:RealVector}(
341341
end
342342

343343
# produce results
344-
r = Array(ROCNums{Int}, nt)
344+
r = Array{ROCNums{Int}}(nt)
345345
fn = 0
346346
tn = 0
347347
@inbounds for i = 1:nt
@@ -354,18 +354,18 @@ function roc{PV<:IntegerVector,SV<:RealVector}(
354354
return r
355355
end
356356

357-
roc{PV<:IntegerVector, SV<:RealVector}(gt::IntegerVector, preds::@compat(Tuple{PV,SV}), thresholds::RealVector) =
357+
roc{PV<:IntegerVector, SV<:RealVector}(gt::IntegerVector, preds::Tuple{PV,SV}, thresholds::RealVector) =
358358
roc(gt, preds, thresholds, Forward)
359359

360-
roc{PV<:IntegerVector, SV<:RealVector}(gt::IntegerVector, preds::@compat(Tuple{PV,SV}), n::Integer, ord::Ordering) =
360+
roc{PV<:IntegerVector, SV<:RealVector}(gt::IntegerVector, preds::Tuple{PV,SV}, n::Integer, ord::Ordering) =
361361
roc(gt, preds, lin_thresholds(preds[2],n,ord), ord)
362362

363-
roc{PV<:IntegerVector, SV<:RealVector}(gt::IntegerVector, preds::@compat(Tuple{PV,SV}), n::Integer) =
363+
roc{PV<:IntegerVector, SV<:RealVector}(gt::IntegerVector, preds::Tuple{PV,SV}, n::Integer) =
364364
roc(gt, preds, n, Forward)
365365

366-
roc{PV<:IntegerVector, SV<:RealVector}(gt::IntegerVector, preds::@compat(Tuple{PV,SV}), ord::Ordering) =
366+
roc{PV<:IntegerVector, SV<:RealVector}(gt::IntegerVector, preds::Tuple{PV,SV}, ord::Ordering) =
367367
roc(gt, preds, 100, ord)
368368

369-
roc{PV<:IntegerVector, SV<:RealVector}(gt::IntegerVector, preds::@compat(Tuple{PV,SV})) =
369+
roc{PV<:IntegerVector, SV<:RealVector}(gt::IntegerVector, preds::Tuple{PV,SV}) =
370370
roc(gt, preds, Forward)
371371

src/utils.jl

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
function repeach{T}(x::AbstractVector{T}, n::Integer)
66
k = length(x)
7-
r = Array(T, k * n)
7+
r = Array{T}(k * n)
88
p = 0
99
@inbounds for i = 1:k
1010
xi = x[i]
@@ -18,7 +18,7 @@ end
1818
function repeach{T}(x::AbstractVector{T}, ns::IntegerVector)
1919
k = length(x)
2020
length(ns) == k || throw(DimensionMismatch("length(ns) should be equal to k."))
21-
r = Array(T, sum(ns))
21+
r = Array{T}(sum(ns))
2222
p = 0
2323
@inbounds for i = 1:k
2424
xi = x[i]
@@ -35,7 +35,7 @@ end
3535
function repeachcol{T}(x::DenseArray{T,2}, n::Integer)
3636
m = size(x, 1)
3737
k = size(x, 2)
38-
r = Array(T, m, k * n)
38+
r = Array{T}(m, k * n)
3939
p = 0
4040
@inbounds for i = 1:k
4141
xi = view(x, :, i)
@@ -66,7 +66,7 @@ end
6666
function repeachrow{T}(x::DenseArray{T,2}, n::Integer)
6767
k = size(x, 1)
6868
m = size(x, 2)
69-
r = Array(T, k * n, m)
69+
r = Array{T}(k * n, m)
7070
p = 0
7171
@inbounds for icol = 1:m
7272
p = 0
@@ -83,7 +83,7 @@ end
8383
function repeachrow{T}(x::DenseArray{T,2}, ns::IntegerVector)
8484
k = size(x, 1)
8585
m = size(x, 2)
86-
r = Array(T, sum(ns), m)
86+
r = Array{T}(sum(ns), m)
8787
@inbounds for icol = 1:m
8888
p = 0
8989
for i = 1:k
@@ -101,8 +101,8 @@ end
101101
## the original array
102102

103103
function unique_inverse(A)
104-
out = Array(eltype(A),0)
105-
out_idx = Array(Vector{Int}, 0)
104+
out = Array{eltype(A)}(0)
105+
out_idx = Array{Vector{Int}}(0)
106106
seen = Dict{eltype(A), Int}()
107107
for (idx, x) in enumerate(A)
108108
if !in(x, keys(seen))

0 commit comments

Comments
 (0)