⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 rule.cpp

📁 用data miming技术进行false prediction
💻 CPP
字号:
#include "Rule.h"

Rule::Rule(string rule, float confidence) {
    this->mRule = rule;
    this->mConfidence = confidence;
    this->populateVectors();
}

string Rule::getRule() const {
    return mRule;
}

float Rule::getConfidence() const {
    return mConfidence;
}

void Rule::populateVectors() {
    int index = mRule.find(">", 0);
    if (index != string::npos) {
        string ifStr = mRule.substr(0, index);
        string thenStr = mRule.substr(index+1);
        string str;

        tokenizer<> tok(ifStr);
        for (tokenizer<>::iterator beg = tok.begin(); beg != tok.end(); ++beg) {
            str = *beg;
            ifVec.push_back(str);
        }

        tokenizer<> tok1(thenStr);
        for (tokenizer<>::iterator beg = tok1.begin(); beg != tok1.end(); ++beg) {
            str = *beg;
            thenVec.push_back(str);
        }
    }
}

vector<string>& Rule::getIfVector() {
    return ifVec;
}

vector<string>& Rule::getThenVector() {
    return thenVec;
}

bool Rule::operator<(const Rule& anotherRule) const {
    if (this->getConfidence() == anotherRule.getConfidence()) {
        return (this->getRule() < anotherRule.getRule());
    } else {
        return (this->getConfidence() < anotherRule.getConfidence());
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -