Skip to content

Commit

Permalink
Removed undocumented pirate old unused functions "findfirst" and "fin…
Browse files Browse the repository at this point in the history
…dall". Push to v0.11.3
  • Loading branch information
sylvaticus committed Feb 9, 2024
1 parent 2acf3ee commit 4bf2d55
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 23 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "BetaML"
uuid = "024491cd-cc6b-443e-8034-08ea7eb7db2b"
authors = ["Antonello Lobianco <[email protected]>"]
version = "0.11.2"
version = "0.11.3"

[deps]
AbstractTrees = "1520ce14-60c1-5f80-bbc7-55ef81b5835c"
Expand Down
7 changes: 0 additions & 7 deletions src/Utils/Processing.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion src/Utils/Utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
8 changes: 6 additions & 2 deletions src/Utils/Utils_extra.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
12 changes: 0 additions & 12 deletions test/Utils_tests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -78,18 +78,6 @@ m = OrdinalEncoder()
= fit!(m,x)
@test== 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)...")
Expand Down

2 comments on commit 4bf2d55

@sylvaticus
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 register

Release notes:

  • bugfixes (removed old, undocumented, unused, type pirate findfirst and findall functions)

@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/100570

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.11.3 -m "<description of version>" 4bf2d55ad3d8cfddeebeaea8396f172c7448020b
git push origin v0.11.3

Please sign in to comment.