123456789101112131415161718192021222324252627282930313233343536 |
- #include "ZScore.h"
- #include "MathUtil.h"
- ZScore::ZScore(const QVector<ZScore::EvaluateIndex> &rMat) : originMat(rMat)
- {
- calcZScoreMat();
- }
- const QVector<ZScore::EvaluateIndex> &ZScore::zScoreResult()
- {
- return zScoreMat;
- }
- ZScore::Relations ZScore::getRelations() const
- {
- //没计算
- return Relations();
- }
- void ZScore::calcZScoreMat()
- {
- if (originMat.count() == 0 || originMat[0].count() == 0) {
- return;
- }
- for (auto index : originMat) {
- std::pair<double, double> rst = Helper::meanAndStandardDeviation(index);
- ZScore::EvaluateIndex zs;
- for (auto v : index) {
- zs << (v - rst.first) / rst.second;
- }
- zScoreMat << zs;
- }
- }
|