k_means.h
1 // OpenNN: Open Neural Networks Library
2 // www.opennn.net
3 //
4 // K - M E A N S H E A D E R
5 //
6 // Artificial Intelligence Techniques SL
7 // artelnics@artelnics.com
8 
9 #ifndef K_MEANS_H
10 #define K_MEANS_H
11 
12 // System includes
13 
14 #include <iostream>
15 #include <fstream>
16 #include <string>
17 #include <sstream>
18 #include <cmath>
19 #include <algorithm>
20 #include <cstdlib>
21 #include <stdexcept>
22 #include <ctime>
23 #include <exception>
24 
25 // OpenNN includes
26 
27 //#include "opennn.h"
28 
29 #include "vector.h"
30 #include "matrix.h"
31 #include "tensor.h"
32 #include "statistics.h"
33 
34 
35 
36 #include "tinyxml2.h"
37 
38 namespace OpenNN
39 {
40 
41 class KMeans
42 {
43 
44 public:
45 
46  struct Results
47  {
48  Vector<Vector<size_t>> clusters;
49  };
50 
51 
52  Results calculate_k_means(const Matrix<double>&, const size_t&) const;
53 
54  size_t calculate_sample_index_proportional_probability(const Vector<double>&) const;
55 };
56 
57 }
58 
59 #endif
60 
61 // OpenNN: Open Neural Networks Library.
62 // Copyright(C) 2005-2019 Artificial Intelligence Techniques, SL.
63 //
64 // This library is free software; you can redistribute it and/or
65 // modify it under the terms of the GNU Lesser General Public
66 // License as published by the Free Software Foundation; either
67 // version 2.1 of the License, or any later version.
68 //
69 // This library is distributed in the hope that it will be useful,
70 // but WITHOUT ANY WARRANTY; without even the implied warranty of
71 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
72 // Lesser General Public License for more details.
73 
74 // You should have received a copy of the GNU Lesser General Public
75 // License along with this library; if not, write to the Free Software
76 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
OpenNN::Matrix< double >
OpenNN::KMeans
Definition: k_means.h:41
OpenNN::KMeans::Results
Definition: k_means.h:46
OpenNN::Vector
This template represents an array of any kind of numbers or objects.
Definition: vector.h:54
OpenNN::KMeans::calculate_k_means
Results calculate_k_means(const Matrix< double > &, const size_t &) const
Definition: k_means.cpp:16