GreyClusterEvaluation.h 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. //
  2. // Created by lenovo on 2023/10/16.
  3. //
  4. #ifndef ALGORITHM_GREYCLUSTEREVALUATION_H
  5. #define ALGORITHM_GREYCLUSTEREVALUATION_H
  6. #include <QVector>
  7. struct GCERange
  8. {
  9. int level; // 等级
  10. double left_left;
  11. double left_val;
  12. double right_val;
  13. double right_right;
  14. };
  15. struct GCEmat
  16. {
  17. double front_val;
  18. double back_val;
  19. };
  20. struct BestIndex
  21. {
  22. int front_index;
  23. int back_index;
  24. };
  25. typedef QVector<GCEmat> GCEMat;
  26. typedef QVector<QVector<GCERange>> GCERangeMat;
  27. /**
  28. * @brief 灰色聚类
  29. */
  30. class GreyClusterEvaluation
  31. {
  32. public:
  33. /**
  34. *
  35. * @param mat : 输入矩阵,一行代表一个指标, 指标中front_val,back_val表示前后样本
  36. * @param ranges : 各项指标的评价等级
  37. */
  38. GreyClusterEvaluation(const GCEMat &mat, const GCERangeMat &ranges);
  39. void evaluate();
  40. BestIndex getBestIndex() const;
  41. int sample_num_; // 样本数
  42. int level_num_; // 等级数
  43. private:
  44. void triangularwhiteningweight(int sam, double front_val, double back_val);
  45. void evaluationlevel(const QVector<double> &weights);
  46. GCEMat mat_;
  47. GCERangeMat ranges_;
  48. QVector<GCEMat> ranges_cv_;
  49. QVector<GCEmat> ranges_weight_;
  50. };
  51. #endif // ALGORITHM_GREYCLUSTEREVALUATION_H