Skip to content

Commit f6edbf7

Browse files
committed
add compathelper
1 parent 8ca7ade commit f6edbf7

File tree

4 files changed

+47
-9
lines changed

4 files changed

+47
-9
lines changed

.github/workflows/CompatHelper.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: CompatHelper
2+
on:
3+
schedule:
4+
- cron: 0 0 * * *
5+
workflow_dispatch:
6+
jobs:
7+
CompatHelper:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- name: "Add the General registry via Git"
11+
run: |
12+
import Pkg
13+
ENV["JULIA_PKG_SERVER"] = ""
14+
Pkg.Registry.add("General")
15+
shell: julia --color=yes {0}
16+
- name: "Install CompatHelper"
17+
run: |
18+
import Pkg
19+
name = "CompatHelper"
20+
uuid = "aa819f21-2bde-4658-8897-bab36330d9b7"
21+
version = "3"
22+
Pkg.add(; name, uuid, version)
23+
shell: julia --color=yes {0}
24+
- name: "Run CompatHelper"
25+
run: |
26+
import CompatHelper
27+
CompatHelper.main()
28+
shell: julia --color=yes {0}
29+
env:
30+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
31+
COMPATHELPER_PRIV: ${{ secrets.DOCUMENTER_KEY }}
32+
# COMPATHELPER_PRIV: ${{ secrets.COMPATHELPER_PRIV }}

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
1010
Tables = "bd369af6-aec1-5ad0-b16a-f7cc5008161c"
1111

1212
[compat]
13-
julia = "1.6"
13+
julia = "1"
1414
LinearAlgebra = "1.6"
1515
NearestNeighbors = "0.4.9"
1616
Statistics = "1.4.0"

test/dbscan.jl

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,22 @@
33
Random.seed!(42)
44

55
df = CSV.read("data/blob_data.csv", DataFrame, drop=[1]);
6-
76
X = df[:,1:2];
7+
88
ϵ = 0.35;
99
min_pts = 10;
1010

11-
X_int = round.(Int, X.*100)
12-
ϵ_int = 35.0;
11+
@testset "test errors" begin
12+
@test_throws ArgumentError dbscan(X[:, 2], ϵ, min_pts)
13+
end
1314

15+
@testset "test Array{Float64, 2}" begin
16+
X_array = Matrix(X)
17+
res_ar = dbscan(X_array, ϵ, min_pts)
18+
n_clusters = unique(res_ar.labels) |> length
19+
@test length(res_ar.labels) == size(X_array, 1)
20+
end
21+
1422
@testset "test dimensions results" begin
1523
res = dbscan(X, ϵ, min_pts)
1624
n_clusters = unique(res.labels) |> length
@@ -23,12 +31,10 @@
2331
end
2432

2533
@testset "test Integer conversion" begin
26-
res_int = dbscan(X_int,ϵ_int, min_pts)
34+
X_int = round.(Int, X.*100)
35+
res_int = dbscan(X_int, ϵ*100, min_pts)
2736
@test eltype(res_int.df) == Float64
2837
@test length(res_int.labels) == size(X_int, 1)
2938
end
3039

31-
@testset "test errors" begin
32-
@test_throws ArgumentError dbscan(X[:, 2], ϵ, min_pts)
33-
end
3440
end

test/kmeans.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434

3535
@testset "diferent types of float" begin
3636
B = rand(Float32, 100, 4)
37-
res2 = kmeans(B, k)
37+
res2 = kmeans(B, k, init=:random)
3838
@test eltype(B) == eltype(res2.centroids[1])
3939
end
4040

0 commit comments

Comments
 (0)