File: samples.hpp

package info (click to toggle)
python-pyclustering 0.10.1.2-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 11,128 kB
  • sloc: cpp: 38,888; python: 24,311; sh: 384; makefile: 105
file content (212 lines) | stat: -rwxr-xr-x 5,172 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
/*!

@authors Andrei Novikov (pyclustering@yandex.ru)
@date 2014-2020
@copyright BSD-3-Clause

*/

#pragma once


#include <string>
#include <vector>
#include <memory>
#include <map>

#include <pyclustering/definitions.hpp>


using namespace pyclustering;


class generic_sample_factory {
public:
    /**
    *
    * @brief   Creates sample for cluster analysis.
    *
    * @param[in] sample: sample that should be created.
    *
    * @return  Smart pointer to created dataset.
    *
    */
    static std::shared_ptr<dataset> create_sample(const std::string & path_sample);
};


/**
*
* @brief   Samples from set SIMPLE SAMPLE that is used for easy testing of clustering algorithms.
*
*/
enum class SAMPLE_SIMPLE {
    SAMPLE_SIMPLE_01,
    SAMPLE_SIMPLE_02,
    SAMPLE_SIMPLE_03,
    SAMPLE_SIMPLE_04,
    SAMPLE_SIMPLE_05,
    SAMPLE_SIMPLE_06,
    SAMPLE_SIMPLE_07,
    SAMPLE_SIMPLE_08,
    SAMPLE_SIMPLE_09,
    SAMPLE_SIMPLE_10,
    SAMPLE_SIMPLE_11,
    SAMPLE_SIMPLE_12,
    SAMPLE_SIMPLE_13
};


/**
*
* @brief   Factory of samples from SIMPLE SAMPLE set.
*
*/
class simple_sample_factory {
private:
    typedef std::map<SAMPLE_SIMPLE, std::string>    map_sample;

private:
    const static map_sample  m_sample_table;

private:
    const static std::string PATH_SAMPLE_SIMPLE_FOLDER;
    const static std::string PATH_SAMPLE_SIMPLE_01;
    const static std::string PATH_SAMPLE_SIMPLE_02;
    const static std::string PATH_SAMPLE_SIMPLE_03;
    const static std::string PATH_SAMPLE_SIMPLE_04;
    const static std::string PATH_SAMPLE_SIMPLE_05;
    const static std::string PATH_SAMPLE_SIMPLE_06;
    const static std::string PATH_SAMPLE_SIMPLE_07;
    const static std::string PATH_SAMPLE_SIMPLE_08;
    const static std::string PATH_SAMPLE_SIMPLE_09;
    const static std::string PATH_SAMPLE_SIMPLE_10;
    const static std::string PATH_SAMPLE_SIMPLE_11;
    const static std::string PATH_SAMPLE_SIMPLE_12;
    const static std::string PATH_SAMPLE_SIMPLE_13;

public:
    /**
    *
    * @brief   Creates sample for cluster analysis.
    *
    * @param[in] p_sample: sample that should be created.
    * @param[in] p_random_order: rearrange randomly data sample.
    *
    * @return  Smart pointer to created dataset.
    *
    */
    static std::shared_ptr<dataset> create_sample(const SAMPLE_SIMPLE p_sample, const bool p_random_order = false);

    /**
    *
    * @brief   Creates random (uniform distribution) sample for cluster analysis.
    *
    * @param[in] p_cluster_size: size of each cluster in dataset.
    * @param[in] p_clusters: amount of clusters in dataset.
    *
    * @return  Smart pointer to created dataset.
    *
    */
    static std::shared_ptr<dataset> create_random_sample(const std::size_t p_cluster_size, const std::size_t p_clusters);
};


/**
*
* @brief   Samples from set FCPS that is used for functional testing of clustering algorithms.
*
*/
enum class FCPS_SAMPLE {
    ATOM,
    CHAINLINK,
    ENGY_TIME,
    GOLF_BALL,
    HEPTA,
    LSUN,
    TARGET,
    TETRA,
    TWO_DIAMONDS,
    WING_NUT
};


/**
*
* @brief   Factory of samples from SIMPLE SAMPLE set.
*
*/
class fcps_sample_factory {
private:
    typedef std::map<FCPS_SAMPLE, std::string>    map_sample;

private:
    const static map_sample  m_sample_table;

private:
    const static std::string PATH_FCPS_SAMPLE_FOLDER;
    const static std::string PATH_SAMPLE_ATOM;
    const static std::string PATH_SAMPLE_CHAINLINK;
    const static std::string PATH_SAMPLE_ENGY_TIME;
    const static std::string PATH_SAMPLE_GOLF_BALL;
    const static std::string PATH_SAMPLE_HEPTA;
    const static std::string PATH_SAMPLE_LSUN;
    const static std::string PATH_SAMPLE_TARGET;
    const static std::string PATH_SAMPLE_TETRA;
    const static std::string PATH_SAMPLE_TWO_DIAMONDS;
    const static std::string PATH_SAMPLE_WING_NUT;

public:
    /**
    *
    * @brief   Creates sample for cluster analysis.
    *
    * @param[in] sample: sample that should be created.
    *
    * @return  Smart pointer to created dataset.
    *
    */
    static std::shared_ptr<dataset> create_sample(const FCPS_SAMPLE sample);
};


/**
*
* @brief   Samples from set FAMOUS that is used for functional testing of clustering algorithms.
*
*/
enum class FAMOUS_SAMPLE {
    OLD_FAITHFUL,
    SAMPLE_IRIS
};


/**
*
* @brief   Factory of samples from FAMOUS SAMPLE set.
*
*/
class famous_sample_factory {
private:
    typedef std::map<FAMOUS_SAMPLE, std::string>    map_sample;

private:
    const static map_sample  m_sample_table;

private:
    const static std::string PATH_FAMOUS_SAMPLE_FOLDER;
    const static std::string PATH_OLD_FAITHFUL;
    const static std::string PATH_IRIS;

public:
    /**
    *
    * @brief   Creates sample for cluster analysis.
    *
    * @param[in] sample: sample that should be created.
    *
    * @return  Smart pointer to created dataset.
    *
    */
    static std::shared_ptr<dataset> create_sample(const FAMOUS_SAMPLE sample);
};