|
1
|
|
|
"""! |
|
2
|
|
|
|
|
3
|
|
|
@brief Cluster analysis algorithm: BIRCH |
|
4
|
|
|
@details Implementation based on article: |
|
5
|
|
|
- T.Zhang, R.Ramakrishnan, M.Livny. BIRCH: An Efficient Data Clustering Method for Very Large Databases. 1996. |
|
6
|
|
|
|
|
7
|
|
|
@authors Andrei Novikov, Aleksey Kukushkin ([email protected]) |
|
8
|
|
|
@date 2014-2017 |
|
9
|
|
|
@copyright GNU Public License |
|
10
|
|
|
|
|
11
|
|
|
@cond GNU_PUBLIC_LICENSE |
|
12
|
|
|
PyClustering is free software: you can redistribute it and/or modify |
|
13
|
|
|
it under the terms of the GNU General Public License as published by |
|
14
|
|
|
the Free Software Foundation, either version 3 of the License, or |
|
15
|
|
|
(at your option) any later version. |
|
16
|
|
|
|
|
17
|
|
|
PyClustering is distributed in the hope that it will be useful, |
|
18
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
19
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
20
|
|
|
GNU General Public License for more details. |
|
21
|
|
|
|
|
22
|
|
|
You should have received a copy of the GNU General Public License |
|
23
|
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
24
|
|
|
@endcond |
|
25
|
|
|
|
|
26
|
|
|
""" |
|
27
|
|
|
|
|
28
|
|
|
import pyclustering.core.antmean_wrapper as wrapper |
|
29
|
|
|
|
|
30
|
|
|
|
|
31
|
|
|
class antmean_clustering_params: |
|
32
|
|
|
def __init__(self): |
|
33
|
|
|
|
|
34
|
|
|
## used for pheramone evaporation |
|
35
|
|
|
self.ro = 0.9 |
|
36
|
|
|
|
|
37
|
|
|
## initial value for pheramones |
|
38
|
|
|
self.pheramone_init = 0.1 |
|
39
|
|
|
|
|
40
|
|
|
## amount of iterations that is used for solving |
|
41
|
|
|
self.iterations = 50 |
|
42
|
|
|
|
|
43
|
|
|
## amount of ants that is used on each iteration |
|
44
|
|
|
self.count_ants = 20 |
|
45
|
|
|
|
|
46
|
|
|
|
|
47
|
|
|
class antmean: |
|
48
|
|
|
def __init__(self, parameters): |
|
49
|
|
|
|
|
50
|
|
|
self.__parameters = None |
|
51
|
|
|
|
|
52
|
|
|
if (parameters is None): |
|
53
|
|
|
self.__parameters = antmean_clustering_params(); |
|
54
|
|
|
else: |
|
55
|
|
|
self.__parameters = parameters; |
|
56
|
|
|
|
|
57
|
|
|
|
|
58
|
|
|
def process(self, count_clusters, samples): |
|
59
|
|
|
return wrapper.antmean_clustering_process(self.__parameters, count_clusters, samples) |
|
60
|
|
|
|
|
61
|
|
|
|