diff --git a/.github/workflows/CompatHelper.yml b/.github/workflows/CompatHelper.yml new file mode 100644 index 0000000..d94b38d --- /dev/null +++ b/.github/workflows/CompatHelper.yml @@ -0,0 +1,32 @@ +name: CompatHelper +on: + schedule: + - cron: 0 0 * * * + workflow_dispatch: +jobs: + CompatHelper: + runs-on: ubuntu-latest + steps: + - name: "Add the General registry via Git" + run: | + import Pkg + ENV["JULIA_PKG_SERVER"] = "" + Pkg.Registry.add("General") + shell: julia --color=yes {0} + - name: "Install CompatHelper" + run: | + import Pkg + name = "CompatHelper" + uuid = "aa819f21-2bde-4658-8897-bab36330d9b7" + version = "3" + Pkg.add(; name, uuid, version) + shell: julia --color=yes {0} + - name: "Run CompatHelper" + run: | + import CompatHelper + CompatHelper.main() + shell: julia --color=yes {0} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + COMPATHELPER_PRIV: ${{ secrets.DOCUMENTER_KEY }} + # COMPATHELPER_PRIV: ${{ secrets.COMPATHELPER_PRIV }} diff --git a/Project.toml b/Project.toml index f952af4..edbe5d8 100644 --- a/Project.toml +++ b/Project.toml @@ -10,7 +10,7 @@ Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2" Tables = "bd369af6-aec1-5ad0-b16a-f7cc5008161c" [compat] -julia = "1.6" +julia = "1" LinearAlgebra = "1.6" NearestNeighbors = "0.4.9" Statistics = "1.4.0" diff --git a/test/dbscan.jl b/test/dbscan.jl index 95c170e..5e7c302 100644 --- a/test/dbscan.jl +++ b/test/dbscan.jl @@ -3,14 +3,22 @@ Random.seed!(42) df = CSV.read("data/blob_data.csv", DataFrame, drop=[1]); - X = df[:,1:2]; + ϵ = 0.35; min_pts = 10; - X_int = round.(Int, X.*100) - ϵ_int = 35.0; + @testset "test errors" begin + @test_throws ArgumentError dbscan(X[:, 2], ϵ, min_pts) + end + @testset "test Array{Float64, 2}" begin + X_array = Matrix(X) + res_ar = dbscan(X_array, ϵ, min_pts) + n_clusters = unique(res_ar.labels) |> length + @test length(res_ar.labels) == size(X_array, 1) + end + @testset "test dimensions results" begin res = dbscan(X, ϵ, min_pts) n_clusters = unique(res.labels) |> length @@ -23,12 +31,10 @@ end @testset "test Integer conversion" begin - res_int = dbscan(X_int,ϵ_int, min_pts) + X_int = round.(Int, X.*100) + res_int = dbscan(X_int, ϵ*100, min_pts) @test eltype(res_int.df) == Float64 @test length(res_int.labels) == size(X_int, 1) end - @testset "test errors" begin - @test_throws ArgumentError dbscan(X[:, 2], ϵ, min_pts) - end end diff --git a/test/kmeans.jl b/test/kmeans.jl index 37d73f2..7d690e8 100644 --- a/test/kmeans.jl +++ b/test/kmeans.jl @@ -34,7 +34,7 @@ @testset "diferent types of float" begin B = rand(Float32, 100, 4) - res2 = kmeans(B, k) + res2 = kmeans(B, k, init=:random) @test eltype(B) == eltype(res2.centroids[1]) end