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
|
/*!
@authors Andrei Novikov (pyclustering@yandex.ru)
@date 2014-2020
@copyright BSD-3-Clause
*/
#pragma once
#include <pyclustering/definitions.hpp>
namespace pyclustering {
namespace clst {
using silhouette_score_sequence = std::vector<double>;
/*!
@class silhouette_ksearch_data silhouette_ksearch_data.hpp pyclustering/cluster/silhouette_ksearch_data.hpp
@brief Defines result of silhouette K-search algorithm.
*/
class silhouette_ksearch_data {
private:
std::size_t m_amount = 0;
double m_score = 0;
silhouette_score_sequence m_scores = { };
public:
/*!
@brief Return optimal amount of clusters.
@return Optimal amount of clusters.
*/
const std::size_t get_amount() const;
/*!
@brief Set optimal amount of clusters (this method is used by Silhouette K-search algorithm).
@param[in] p_amount: optimal amount of clusters.
*/
void set_amount(const std::size_t p_amount);
/*!
@brief Returns optimal amount of clusters that has been found during the analysis.
@return Optimal amount of clusters that has been found during the analysis.
*/
const double get_score() const;
/*!
@brief Set optimal amount of clusters that has been found during the analysis (this method is used by Silhouette K-search algorithm).
@param[in] p_score: optimal amount of clusters that has been found during the analysis.
*/
void set_score(const double p_score);
/*!
@brief Returns constant reference to silhouette score for each K value (amount of clusters).
@return Constant reference to silhouette score for each K value (amount of clusters).
*/
const silhouette_score_sequence & scores() const;
/*!
@brief Returns reference to silhouette score for each K value (amount of clusters).
@return Reference to silhouette score for each K value (amount of clusters).
*/
silhouette_score_sequence & scores();
public:
/*!
@brief Compares Silhouette K-search results.
@param[in] p_other: another Silhouette K-search result that is used for comparison.
@return Returns true if both objects are the same.
*/
bool operator==(const silhouette_ksearch_data & p_other) const;
};
}
}
|