#include "ZScore.h" #include "MathUtil.h" ZScore::ZScore(const QVector &rMat) : originMat(rMat) { calcZScoreMat(); } const QVector &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 rst = Helper::meanAndStandardDeviation(index); ZScore::EvaluateIndex zs; for (auto v : index) { zs << (v - rst.first) / rst.second; } zScoreMat << zs; } }