From 828aeca75b227555093bfb301d2de93d657fd6f6 Mon Sep 17 00:00:00 2001 From: annoviko Date: Wed, 23 Jan 2019 19:03:35 +0300 Subject: [PATCH] #381: Create skeleton of CLIQUE algorithm. --- docs/citation.bib | 16 ++++++++- pyclustering/cluster/clique.py | 65 ++++++++++++++++++++++++++++++++++ 2 files changed, 80 insertions(+), 1 deletion(-) create mode 100755 pyclustering/cluster/clique.py diff --git a/docs/citation.bib b/docs/citation.bib index d947654b..e431b6db 100755 --- a/docs/citation.bib +++ b/docs/citation.bib @@ -579,6 +579,20 @@ @article{article::cluster::silhouette::1 url = {http://dx.doi.org/10.1016/0377-0427(87)90125-7}, doi = {10.1016/0377-0427(87)90125-7}, publisher = {Elsevier Science Publishers B. V.}, -} +} +@article{article::clique::1, + author = "Agrawal, Rakeshand Gehrke, Johannes and Gunopulos, Dimitrios and Raghavan, Prabhakar", + title = "Automatic Subspace Clustering of High Dimensional Data", + journal = "Data Mining and Knowledge Discovery", + year = "2005", + month = "Jul", + day = "01", + volume = "11", + number = "1", + pages = "5--33", + issn = "1573-756X", + doi = "10.1007/s10618-005-1396-1", + url = "https://doi.org/10.1007/s10618-005-1396-1" +} diff --git a/pyclustering/cluster/clique.py b/pyclustering/cluster/clique.py new file mode 100755 index 00000000..25f64930 --- /dev/null +++ b/pyclustering/cluster/clique.py @@ -0,0 +1,65 @@ +"""! + +@brief Cluster analysis algorithm: CLIQUE +@details Implementation based on paper @cite article::clique::1. + +@authors Andrei Novikov (pyclustering@yandex.ru) +@date 2014-2019 +@copyright GNU Public License + +@cond GNU_PUBLIC_LICENSE + PyClustering is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + PyClustering is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +@endcond + +""" + + +class spatial_block: + def __init__(self): + pass + + +class clique: + def __init__(self, data, amount_intervals, density_threshold): + self.__data = data + self.__amount_intervals = amount_intervals + self.__density_threshold = density_threshold + + self.__clusters = [] + self.__noise = [] + + self.__validate_arguments() + + + def process(self): + pass + + + def get_clusters(self): + return self.__clusters + + + def get_noise(self): + return self.__noise + + + def __validate_arguments(self): + if len(self.__data) == 0: + raise ValueError("Empty input data. Data should contain at least one point.") + + if self.__amount_intervals <= 0: + raise ValueError("Incorrect amount of intervals '%d'. Amount of intervals value should be greater than 0." % self.__amount_intervals) + + if self.__density_threshold < 0: + raise ValueError("Incorrect density threshold '%f'. Density threshold should not be negative." % self.__density_threshold) \ No newline at end of file