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

📄 ruleevaluator.cpp

📁 粗糙集应用软件
💻 CPP
字号:
//-------------------------------------------------------------------
// Author........: Aleksander 豩rn
// Date..........:
// Description...:
// Revisions.....:
//===================================================================

#include <stdafx.h> // Precompiled headers.
#include <copyright.h>

#include <kernel/algorithms/ruleevaluator.h>

#include <kernel/structures/decisiontable.h>
#include <kernel/structures/rule.h>

#include <kernel/system/math.h>

//-------------------------------------------------------------------
// Methods for class RuleEvaluator.
//===================================================================

//-------------------------------------------------------------------
// Method........: Constructors/destructor
// Author........: Aleksander 豩rn
// Date..........:
// Description...:
// Comments......:
// Revisions.....:
//===================================================================

RuleEvaluator::RuleEvaluator() {
}

RuleEvaluator::RuleEvaluator(const DecisionTable &table) {

	bool masked = true;

	// Get stuff for computing coverage.
	if (!table.GetValueSet(decisions_, cardinalities_, table.GetDecisionAttribute(masked), masked)) {
		decisions_.erase(decisions_.begin(), decisions_.end());
		cardinalities_.erase(cardinalities_.begin(), cardinalities_.end());
		Message::Error("Call to DecisionTable::GetValueSet failed.");
	}

	// Get |U|.
	table_cardinality_ = table.GetNoObjects(masked);

}

RuleEvaluator::~RuleEvaluator() {
}

//-------------------------------------------------------------------
// Method........: GetAccuracy
// Author........: Aleksander 豩rn
// Date..........:
// Description...:
// Comments......:
// Revisions.....:
//===================================================================

float
RuleEvaluator::GetAccuracy(const Rule &rule, int i) const {
	return rule.GetAccuracy(i);
}

//-------------------------------------------------------------------
// Method........: GetCoverage
// Author........: Aleksander 豩rn
// Date..........:
// Description...:
// Comments......:
// Revisions.....:
//===================================================================

float
RuleEvaluator::GetCoverage(const Rule &rule, int i) const {
	return rule.GetCoverage(i, decisions_, cardinalities_);
}

//-------------------------------------------------------------------
// Method........: GetContingencyTable
// Author........: Thomas 舋otnes
// Date..........: 981029
// Description...: Computes the elements of the contingency table for a
//                 given rule and a given RHS position.
//
// Comments......: Values for a rule R = alpha -> beta[i] are:
//
//                   a = support(alpha,     beta)
//                   b = support(alpha,     not beta)
//                   c = support(not alpha, beta)
//                   d = support(not alpha, not beta)
//
//                   B = support(beta)  = a + c
//                   A = support(alpha) = a + b
//                   K = a + b + c + d
//
//                             | beta  | not beta |
//                   ------------------------------------
//                       alpha | a     | b        | A
//                   not alpha | c     | d        | K - A
//									 ------------------------------------
//                             | B     | K - B    | K
//
// Revisions.....: A

⌨️ 快捷键说明

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