File: elbow_data.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 (96 lines) | stat: -rwxr-xr-x 1,868 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
/*!

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

*/

#pragma once


#include <vector>


namespace pyclustering {

namespace clst {


/*!

@brief  Sequence container to store within cluster errors (WCE) for each K-value.

*/
using wce_sequence      = std::vector<double>;


/*!

@class  elbow_data elbow_data.hpp pyclustering/cluster/elbow_data.hpp

@brief  Elbow analysis result that contain information about optimal amount of clusters and
         total within cluster errors (WCE) for each K-value.

*/
class elbow_data {
private:
    std::size_t           m_amount  = 0;
    wce_sequence          m_wce     = { };

public:
    /*!
    
    @brief  Default constructor of the Elbow result.
    
    */
    elbow_data() = default;

    /*!

    @brief  Default desctructor of the Elbow result.

    */
    ~elbow_data() = default;

public:
    /*!
    
    @brief  Returns constant reference to total within cluster errors (WCE) for each K-value.

    @return Constant reference to total within cluster errors (WCE) for each K-value.
    
    */
    const wce_sequence & get_wce() const { return m_wce; }

    /*!

    @brief  Returns reference to total within cluster errors (WCE) for each K-value.

    @return Reference to total within cluster errors (WCE) for each K-value.

    */
    wce_sequence & get_wce() { return m_wce; }

    /*!

    @brief   Set optimal amount of clusters.
    @details The method is used by Elbow method to set the final analysis result.

    */
    void set_amount(const std::size_t p_amount) { m_amount = p_amount; }

    /*!

    @brief   Returns optimal amount of clusters.

    @return  Optimal amount of clusters.

    */
    std::size_t get_amount() const { return m_amount; }
};


}

}