diff --git a/Project.toml b/Project.toml index a66cf6a6..09381711 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "BetaML" uuid = "024491cd-cc6b-443e-8034-08ea7eb7db2b" authors = ["Antonello Lobianco "] -version = "0.11.2" +version = "0.11.3" [deps] AbstractTrees = "1520ce14-60c1-5f80-bbc7-55ef81b5835c" diff --git a/src/Utils/Processing.jl b/src/Utils/Processing.jl index 4bde3c47..10234131 100644 --- a/src/Utils/Processing.jl +++ b/src/Utils/Processing.jl @@ -65,13 +65,6 @@ function singleunique(x::Union{T,AbstractArray{T}}) where {T <: Union{Any,Abstra end end -findfirst(el::T,cont::Array{T};returnTuple=true) where {T<:Union{AbstractString,Number}} = ndims(cont) > 1 && returnTuple ? Tuple(findfirst(x -> isequal(x,el),cont)) : findfirst(x -> isequal(x,el),cont) -#findfirst(el::T,cont::Array{T,N};returnTuple=true) where {T,N} = returnTuple ? Tuple(findfirst(x -> isequal(x,el),cont)) : findfirst(x -> isequal(x,el),cont) -#findfirst(el::T,cont::Array{T,1};returnTuple=true) where {T} = findfirst(x -> isequal(x,el),cont) - - -findall(el::T, cont::Array{T};returnTuple=true) where {T} = ndims(cont) > 1 && returnTuple ? Tuple.(findall(x -> isequal(x,el),cont)) : findall(x -> isequal(x,el),cont) - # API V2 for encoders diff --git a/src/Utils/Utils.jl b/src/Utils/Utils.jl index 37151cf8..87a63582 100644 --- a/src/Utils/Utils.jl +++ b/src/Utils/Utils.jl @@ -68,7 +68,7 @@ export @codelocation, generate_parallel_rngs, get_parametric_types, isinteger_bml # Various functions that we add a method to -import Base.print, Base.println, Base.findfirst, Base.findall, Base.error, Random.shuffle, Base.show +import Base.print, Base.println, Base.error, Random.shuffle, Base.show include("Miscellaneous.jl") diff --git a/src/Utils/Utils_extra.jl b/src/Utils/Utils_extra.jl index 1639e2a4..2544d69d 100644 --- a/src/Utils/Utils_extra.jl +++ b/src/Utils/Utils_extra.jl @@ -255,7 +255,7 @@ function fit!(m::AutoEncoder,X) if cache xtemp = copy(X) for el in fullnn.par.nnstruct.layers[1:m.par.n_el] - xtemp = vcat([forward(el,r) for r in eachrow(xtemp)]'...) + xtemp = vcat([forward(el,r) for r in eachrow(xtemp)]'...) # TODO: for some layers the data is not a vector! end m.cres = xtemp|> makematrix end @@ -266,8 +266,12 @@ end function predict(m::AutoEncoder,X) xtemp = copy(X) + (N,D) = size(X) + + #for r in eachrow(X) + for el in m.par.fullnn.par.nnstruct.layers[1:m.par.n_el] - xtemp = vcat([forward(el,r) for r in eachrow(xtemp)]'...) + xtemp = vcat([forward(el,r) for r in eachrow(xtemp)]'...) # TODO: for some layers the data is not a vector! end return xtemp|> makematrix end diff --git a/test/Utils_tests.jl b/test/Utils_tests.jl index 238c2241..091f94a6 100644 --- a/test/Utils_tests.jl +++ b/test/Utils_tests.jl @@ -78,18 +78,6 @@ m = OrdinalEncoder() x̂ = fit!(m,x) @test x̂ == x -# ================================== -# NEW TEST -println("Testing findFirst/ findall / integerencoder / integerdecoder...") - -a = ["aa","cc","cc","bb","cc","aa"] -A = [3 2 1; 2 3 1; 1 2 3] -@test findfirst("cc",a) == 2 -@test findall("cc",a) == [2,3,5] -@test findfirst(2,A) == (2,1) -@test findall(2,A) == [(2,1),(1,2),(3,2)] -@test findfirst(2,A;returnTuple=false) == CartesianIndex(2,1) - # ================================== # TEST 2: softmax println("** Going through Test2 (softmax and other activation functions)...")