|
1 | 1 | # ClusterAnalysis.jl
|
2 | 2 |
|
3 |
| -```@raw html |
4 |
| -<img src="plot_dbscan.png" width="70%"> |
5 |
| -``` |
6 |
| - |
7 |
| -This package was **BUILT FROM SCRATCH**, entirely in [Julia Lang](https://julialang.org), and implements a few popular clustering algorithms like K-Means and DBSCAN. |
| 3 | +This package was **Built from scratch**, entirely in [Julia Lang](https://julialang.org), and implements a few popular clustering algorithms like K-Means and DBSCAN. |
8 | 4 |
|
9 | 5 | This is mostly a learning experiment, but the package were also built and documented to be used by anyone, Plug-and-Play. Just input your data as an Array or a [Tables.jl](https://discourse.julialang.org/t/tables-jl-a-table-interface-for-everyone/14071) type (like [DataFrames.jl](https://dataframes.juliadata.org/stable/)), then start training your clusters algorithms and analyze your results.
|
10 | 6 |
|
| 7 | + |
11 | 8 | ## Algorithms Implemented
|
12 | 9 | Currently we implemented two types of algorithms, a partitioned based ([K-Means](https://en.wikipedia.org/wiki/K-means_clustering)) and a spatial density based ([DBSCAN](https://en.wikipedia.org/wiki/DBSCAN)).
|
13 | 10 |
|
14 |
| -> Go check the `Algorithms` Section that contains all the details of how it works the algorithm and also got the bibliography and papers used during the research and development of the code. It's a great introduction to the algorithm and a good resource to read along with the source code. |
| 11 | +> Go check the `Algorithms` Section that contains all the details of how it works the algorithm and also got the bibliography and papers used during the research and development of the code. |
| 12 | +
|
| 13 | +> It's a great introduction to the algorithm and a good resource to read along with the source code. |
15 | 14 |
|
16 | 15 | ## How to install ClusterAnalysis.jl
|
17 |
| -Since this package it's not registred, it's necessary to use the github url as shown below. |
18 | 16 |
|
19 | 17 | ```julia
|
20 | 18 | # press ] to enter in Pkg REPL mode.
|
21 |
| -pkg> add https://github.com/AugustoCL/ClusterAnalysis.jl |
| 19 | +pkg> add ClusterAnalysis |
22 | 20 | ```
|
| 21 | + |
| 22 | +## A quick example |
| 23 | + |
| 24 | +```julia |
| 25 | +using ClusterAnalysis, DataFrames, CSV |
| 26 | + |
| 27 | +# load blob dataset from repo in github |
| 28 | +df = CSV.read("algo_overview/blob_data.csv", DataFrame, drop=[1]); |
| 29 | +X = df[:,1:2]; |
| 30 | +y = df[:,end]; |
| 31 | + |
| 32 | +# parameters of k-means |
| 33 | +ϵ = 0.35; |
| 34 | +min_pts = 10; |
| 35 | + |
| 36 | +# executing DBSCAN |
| 37 | +m = dbscan(X, ϵ, min_pts); |
| 38 | + |
| 39 | +# plot |
| 40 | +scatter(X[:,1], X[:,2], zcolor=m.labels, |
| 41 | + leg=false, |
| 42 | + title="DBSCAN prediction\n(ϵ=$(ϵ), minPts=$(min_pts))") |
| 43 | +``` |
| 44 | + |
| 45 | +```@raw html |
| 46 | +<img src="plot_dbscan.png" width="70%"> |
| 47 | +``` |
0 commit comments