當前位置: 首頁>>代碼示例>>Java>>正文


Java RuleModel類代碼示例

本文整理匯總了Java中com.rapidminer.operator.learner.rules.RuleModel的典型用法代碼示例。如果您正苦於以下問題:Java RuleModel類的具體用法?Java RuleModel怎麽用?Java RuleModel使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


RuleModel類屬於com.rapidminer.operator.learner.rules包,在下文中一共展示了RuleModel類的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: addRules

import com.rapidminer.operator.learner.rules.RuleModel; //導入依賴的package包/類
private void addRules(RuleModel ruleModel, Rule currentRule, Tree tree) {
	if (tree.isLeaf()) {
		currentRule.setLabel(tree.getLabel());
		int[] frequencies = new int[ruleModel.getLabel().getMapping().size()];
		int index = 0;
		for (String labelValue : ruleModel.getLabel().getMapping().getValues()) {
			frequencies[index++] = tree.getCount(labelValue);
		}
		currentRule.setFrequencies(frequencies);
		ruleModel.addRule(currentRule);
	} else {
		Iterator<Edge> e = tree.childIterator();
		while (e.hasNext()) {
			Edge edge = e.next();
			SplitCondition condition = edge.getCondition();
			Tree child = edge.getChild();
			Rule clonedRule = (Rule) currentRule.clone();
			clonedRule.addTerm(condition);
			addRules(ruleModel, clonedRule, child);
		}
	}
}
 
開發者ID:transwarpio,項目名稱:rapidminer,代碼行數:23,代碼來源:Tree2RuleConverter.java

示例2: addRules

import com.rapidminer.operator.learner.rules.RuleModel; //導入依賴的package包/類
private void addRules(RuleModel ruleModel, Rule currentRule, Tree tree) {
	if (tree.isLeaf()) {
		currentRule.setLabel(tree.getLabel());
		int[] frequencies = new int[ruleModel.getLabel().getMapping().size()];
		int index = 0;
		for (String labelValue : ruleModel.getLabel().getMapping().getValues()) {
			frequencies[index++] = tree.getCount(labelValue);
		}
		currentRule.setFrequencies(frequencies);
		ruleModel.addRule(currentRule);
	} else {
		Iterator<Edge> e = tree.childIterator();
		while (e.hasNext()) {
			Edge edge = e.next();
			SplitCondition condition = edge.getCondition();
			Tree child = edge.getChild();
			Rule clonedRule = (Rule)currentRule.clone();
			clonedRule.addTerm(condition);
			addRules(ruleModel, clonedRule, child);
		}
	}
}
 
開發者ID:rapidminer,項目名稱:rapidminer-5,代碼行數:23,代碼來源:Tree2RuleConverter.java


注:本文中的com.rapidminer.operator.learner.rules.RuleModel類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。